PostgreSQL IQ
PostgreSQL IQ
aa PostgreSQL
Interview Questions
lliP
te
In
t
Windows, Linux, and macOS.
aa
Read along as we cover all the top industry questions related to PostgreSQL and
help you ace your next interview.
Conclusion
t
● Postgres is the undisputed most admired and desired database in Stack
Overflow’s 2023 developer survey, according to the article published on EDB.
aa
● Over 60% of Fortune 500 companies and Fortune 50 banks trust PostgreSQL
for their data management needs.
● PostgreSQL also has a feature that includes being relational and
object-oriented in design and is also called an ORDBMS.
lliP
PostgreSQL Basic Interview Questions for
Freshers
te
1. What is PostgreSQL?
t
3. Define a non-clustered index.
aa
In a non-clustered index, the order of the index rows differs from the physical order
of the real data. The leaf pages of a non-clustered index instead contain pointers to
the real data rather than the actual data itself. Its main advantage is that it provides
faster access to data.
lliP
4. Which data types are used in PostgreSQL?
t
administration tool. This web-based GUI tool is prominently used to manage
PostgreSQL databases. It assists in monitoring and managing numerous complex
aa
PostgreSQL and EDB database systems. PgAdmin is used to accomplish tasks like
accessing, developing, and carrying out quality testing procedures.
t
The full form of GEQO is Genetic Query Optimization. It enables non-exhaustive
search to efficiently manage large join queries in PostgreSQL.
aa
11. What do you mean by index in PostgreSQL?
the market?
As of 2022, the latest version of PostgreSQL in the market is PostgreSQL 15. It was
launched on 13 October, 2022.
t
embedded by a C-style backslash.
aa
Example: ‘This is an example of a string constant bound by single quotes.’
Let’s take an example of an ATM machine. If concurrency is not applied in this case,
different users won’t be able to access their accounts and draw money at the same
time. Whereas if concurrency control is enabled, then multiple users can do so
easily.
Table Partitioning in PostgreSQL is the process wherein a large table is split into
smaller pieces. These smaller pieces are known as partitions. List and range
partitioning is supported by PostgreSQL through its table inheritance feature.
t
Each partition can store data according to how frequently it is used, allowing
low-use data to be stored on media that may be slower or less expensive.
aa
18. Explain the use of PostgreSQL triggers.
Are you looking forward to building a career in AWS? Enroll in this professional course to
start your journey today! AWS Certification Training Course for Solutions Architect
Operators are the special characters or words that are used mainly in the WHERE
clause in PostgreSQL. These operators can be used to perform a variety of
functions and operations.
t
aa
lliP
The different types of operators that are used in PostgreSQL are as follows:-
● Arithmetic operators
● Logical operators
te
● Comparison operators
● Bitwise operators
In
In PostgreSQL, CTIDs serve as unique identifiers for each record within a table. The
CTID field enables the precise location of physical rows based on their offset and
block positions, facilitating the effective distribution of data across the table. By
utilizing CTID fields, users can gain insights into the actual storage positions of rows
within the database table.
To access the database data, the first step is to start the database server. The
database server application, known as Postgres, plays a crucial role in managing the
database. It actively seeks information about the data it needs to utilize, which is
essential for its effective functioning. By initiating the database server and providing
the necessary data location details, users can actively enable access and utilization
of the database data through the Postgres software.The -D option is used to
accomplish this.
t
Execute these commands to start the database server:
aa
● usr/local/etc/rc.d/010.pgsql.sh start
● /usr/local/etc/rc.d/postgresql start
The maximum number of blocks in a table decides the limit of the table. As the
number of blocks is 2^32 and 8192 bytes is the default size of the block, therefore,
the maximum size of a table on PostgreSQL is 32TB.
PostgreSQL MongoDB
t
management system. management system.
aa
PostgreSQL was created using the C MongoDB was created using the C++
language. language.
t
applications, including web development, data analysis, and enterprise solutions. It
aa
provides advanced features like JSON support and geospatial capabilities. With its
cross-platform compatibility and active community, developers can rely on
PostgreSQL for scaling and achieving optimal performance while managing
complex data.
lliP
27. Describe the history of PostgreSQL in brief.
PostgreSQL has upheld ACID properties since 2001, with continuous core platform
development spanning over three decades. It encompasses noteworthy additions
like the PostGIS database extender and has become the standard database for
In
macOS. commonly known as Postgres, due to its widespread adoption of the SQL
Standard among relational databases.
t
configure the connection.
aa
● Finally, you must define “Port” as “5432,” which is the PostgreSQL server’s
default port.
Using table spaces, the disk layout of a PostgreSQL installation can be easily
handled and managed.
Check out the blog to know what are the differences between the popular databases i.e.
t
Postgresql vs. MySQL.
aa
31. Explain the term ‘Sequence’ in PostgreSQL.
The Sequence is a generator that produces a progressive number that can help
synchronize the keys across multiple rows or tables and construct a single primary
lliP
key automatically.
Index is considered the main data in the In the case of a non-clustered index,
clustered index. the index is the copy of data.
The clustered index has the ability to The non-clustered index cannot
store data naturally on the disk. naturally store data on the disk.
t
It requires less memory for operations as The non-clustered index requires
aa
compared to the non-clustered index. more memory to perform
operations.
A table can consist of only one clustered A table can contain multiple
lliP
index. non-clustered indexes.
It has a few debugging symbols that make it easier for developers to find flaws and
other issues that can arise during the script’s execution. This process can slow
down or impede the system when it is being used, increasing the size of the binary
file.
The data type of one or more columns in PostgreSQL can be changed by using the
t
following commands along with the TYPE keyword:
aa
1 ALTER TABLE
2 ALTER COLUMN
lliP
Example:
Experienced Professionals
The LIMIT keyword can be used to select the first N records in PostgreSQL.
Example:
Here, the Employee is the name of the table that contains employee data.
ORDER BY command arranges the data in descending order based on the salary of
employees.
t
LIMIT keyword used with the number 5 prints the first 5 or the top 5 records
aa
present in the Employee table.
● Easy to use
t
39. What are the physical methods used in PostgreSQL
aa
for replication?
PostgreSQL?
When data changes occur at the same time in different places, such as multi, which
t
may lead to replication conflicts, the software automatically ensures the change
aa
that should be allowed with the help of “conflict handlers” in PostgreSQL. These
conflict handlers automatically resolve the changes applicable to avoid conflicts.
until they are received and applied by all servers. This ensures that the primary
server will not delete these files prematurely.
t
44. How can you take the backup of a database?
aa
PostgreSQL permits the user to take a backup of the database by using “pg_dump”.
To perform a backup on a plain-text SQL file, login into your database server and
implement the following command:
lliP
1 pg_dump database_name > filename.sql
The database can be reconstructed using the commands available in the SQL file.
45. How can you stop a PostgreSQL Server? Can you stop
In
● For Windows
After that, open the command prompt and execute the following command-
t
● Click Stop to stop the database server.
aa
● For Linux
No, PostgreSQL does not allow the user to stop a specific database in the cluster.
In
File-level backups involve making copies of the files that make up the database
cluster. This includes data files, configuration files, and transaction logs. This
method is great for disaster recovery situations where you need to restore the
database cluster. However, because it copies all the files, the backup files can be
quite large. Require storage space.
On the other hand, logical backups export data in a format using tools like
pg_dump. These backups are smaller in size. Offer flexibility when it comes to
selectively restoring specific databases, tables, or subsets of data. However, they
can be slower compared to file-level backups when it comes to both backup and
restore operations
t
aa
47. Discuss the advantages and limitations of using
pg_dump for backups.
t
2. Restore the base backup.
aa
3. Apply the WAL files either by using recovery.conf or via a server.
4. Stop the recovery process when you reach the recovery point you desire.
5. Allow read-write operations on the database.
4. Keep an eye on the restoration process. Ensure that you verify the
restored data once it is completed.
The main objective of the pg_archivecleanup tool in PostgreSQL is to get rid of WAL
(Write Ahead Logging) files from the directory. This ensures that only the necessary
WAL files required for Point-In-Time-Recovery (PITR) are kept intact.
t
aa
Intermediate ₹6- 12 lakhs 85k-110k
Senior
lliP ₹12- 20 lakhs 110k-160k
Global Scenario PostgreSQL: The world job landscape for PostgreSQL experts is
increasing, boasting over 18,000 active job openings globally. This surge underlines
te
the rising demand for professionals with robust database management capabilities.
In India, the market is also flourishing with openings on platforms like Indeed and
Linkedin.
In
PostgreSQL is not just a skill; it’s your gateway to an evolving global job market.
t
Database They are specialized in designing and implementing
Developer database structures.
aa
Data Engineer They are involved in the design and maintenance of data
lliP pipelines and ETL.
Database Architect They ensure that the database architecture aligns with
business requirements.
Data Analyst They are responsible for extracting meaningful insights for
better decision-making.
Technical Support They assist the users in resolving the issues by guiding best
Engineer: practices.
t
aa
The roles and responsibilities of a PostgreSQL are quite diverse and vary for
different departments.You can check it with JD of LTIMindtree. Some of the most
important roles and responsibilities of a PostgreSQL are as follows:
Conclusion
Join our SQL community to check out our community page to see what other learners
t
are learning.
aa
lliP
te
In