0% found this document useful (0 votes)
201 views

Interview Questions Postgres

PostgreSQL is an open-source, object-relational database management system that supports advanced features like function overloading and table inheritance. It is robust, fault-tolerant due to write-ahead logging, and can be used to create large-scale web applications. A non-clustered index contains pointers to real data rather than actual data, providing faster access. PgAdmin is a popular open-source GUI tool used to manage PostgreSQL databases.

Uploaded by

A B Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views

Interview Questions Postgres

PostgreSQL is an open-source, object-relational database management system that supports advanced features like function overloading and table inheritance. It is robust, fault-tolerant due to write-ahead logging, and can be used to create large-scale web applications. A non-clustered index contains pointers to real data rather than actual data, providing faster access. PgAdmin is a popular open-source GUI tool used to manage PostgreSQL databases.

Uploaded by

A B Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

1. What is PostgreSQL?

PostgreSQL or Postgres is a relational database management system that is robust and open-source. It is object-
relational, which means that it supports features like Function Overloading and Table Inheritance. PostgreSQL
is used for creating advanced applications. It is compatible with all the main operating systems such as
Windows, UNIX, macOS, and Linux.

2. What are the advantages of PostgreSQL?

The advantages of PostgreSQL include:

 PostgreSQL is highly fault-tolerant, owing to its feature of write-ahead logging.


 It is flexible and easy to learn.
 It supports a variety of replication methods.
 It can be used for large-scale web applications because of its powerful and robust nature.
 As the source code of PostgreSQL is available for free due to its open-source license, users can edit and
modify it easily according to their business requirements.

3. Define a non-clustered index.

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.

4. Which data types are used in PostgreSQL?

The following data types are used in PostgreSQL:-

 Numeric data type (Integer, Float)


 Geometric primitives
 Boolean data type
 Character data type (varchar, char, text)
 Monetary data type
 Array
 Document data type (JSON, XML, Key-value, etc.)
 Date/Time data type
 Customization data type (Composite, custom types, etc.)

5. What do you mean by a parallel query?

Parallel query in PostgreSQL is an advanced feature. It allows the arrangement of query plans in such a way
that they can exploit multiple CPUs. This helps in answering user queries in a much faster and quicker manner.

6. What is the meaning of PgAdmin?

PgAdmin is a free open-source graphical front-end PostgreSQL database administration tool. This web-based
GUI tool is prominently used to manage PostgreSQL databases. It assists in monitoring and managing
numerous complex PostgreSQL and EDB database systems. PgAdmin is used to accomplish tasks like
accessing, developing, and carrying out quality testing procedures.
7. Define Write-Ahead logging.

Write-Ahead Logging is a technique used to ensure the data integrity of PostgreSQL databases. It helps in
maintaining the resilience or the reliability of the database. Write-ahead logging is a method wherein any
changes and actions in the database are logged in a transaction log prior to the updating or modification of the
database. In case there is a database crash, this feature helps the in providing the log of the database changes. In
addition, it also helps the user in resuming work from where it was discontinued, after the crash.

8. What is the full form of MVCC?

The full form of MVCC is Multi-version Concurrency Control.

9. Why do companies use PostgreSQL?

Numerous high-profile organizations, such as Apple, Spotify, IMDb, Instagram, and Skype, make use
PostgreSQL database, owing to its excellent features:

 PostgreSQL is extremely easy to use.


 It is a powerful and robust open-source tool.
 PostgreSQL follows and supports the ACID properties.
 It supports MVCC (Multiversion Concurrency Control).
 It is highly fault-tolerant.
 It runs on almost all different operating systems.

10. What is the full form of GEQO?

The full form of GEQO is Genetic Query Optimization. It enables non-exhaustive search to efficiently manage
large join queries in PostgreSQL.

11. What do you mean by index in PostgreSQL?

An index in PostgreSQL is a way of increasing the speed and efficiency of the database. Databases use indexes
as special lookup tables that help them retrieve data in a much quicker manner. Indexes enable the user to find
specific rows in a database. They act like pointers to the data in the database, thereby enhancing the overall
performance.

12. Which is the main query language of PostgreSQL?

SQL or Structured Query Language is the main query language of PostgreSQL.

13. What do you think is the latest PostgreSQL version in the market?

As of 2022, the latest version of PostgreSQL in the market is PostgreSQL 15. It was launched on 13 October,
2022.

14. What is the full form of ORDBMS?

The full form of ORDBMS is Object-Relational Database Management System.


15. What do you mean by a string constant in PostgreSQL?

A string constant is defined as the sequence of characters that are bounded by single quotes i.e., (‘). It can be
used during insertion or while passing the characters to the database objects. This is an important feature when
performing the parsing of data. In the case of PostgreSQL, string constant is allowed with single quotes but
embedded by a C-style backslash.

Example: ‘This is an example of a string constant bound by single quotes.’

Intermediate PostgreSQL Interview Questions and Answers


16. What is Multi-version Control?

Multi-version Concurrency Control or MVCC is a technique to enhance database performance by handling


concurrency in PostgreSQL databases. It prevents the locking of databases. MVCC reduces the delay time that
users face while logging into their accounts and comes into action when someone else is accessing the contents
of the account.

Inconsistency occurs when numerous transactions attempt to access the same data. To preserve data
consistency, concurrency control is necessary.

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.

17. Explain table partitioning in PostgreSQL.

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.

Table partitioning helps in increasing the query performance of PostgreSQL, as it is much easier to select data
from these partitions rather than selecting from one main table.

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.

18. Name the different types of operators that are used in PostgreSQL.

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.
The different types of operators that are used in PostgreSQL are as follows:-

 Arithmetic operators
 Logical operators
 Comparison operators
 Bitwise operators

19. What do you mean by the CTID field in PostgreSQL?

CTIDs are unique records in PostgreSQL for each table. CTID field in PostgreSQL helps in locating specific
physical rows in a table based on their offset and block positions. This helps in balancing the positions in the
table. Through CTID fields the users can gain an idea of how the rows are really stored in the database table.

20. How do you start a database server in PostgreSQL?

The necessary condition to be able to access the data of the database is to initially start the database server.
Postgres is the name of the database server application. The Postgres software needs to know where to seek the
data it should use. The -D option is used to accomplish this.

Execute these commands to start the database server:

 usr/local/etc/rc.d/010.pgsql.sh start
 /usr/local/etc/rc.d/postgresql start

Another way to start a database server in PostgreSQL is:

 Start by pressing the Windows key + R simultaneously to enter the Run Window.
 To find the PostgreSQL services, type services.msc next.
 Using the version that is installed, search the Postgres service.
 Click on Start to start the database server.

21. Explain the use of PostgreSQL triggers.

A trigger can be defined as a function that is called automatically when the insertion, updation, or deletion event
occurs. They serve as a way to check the data integrity. Triggers are capable of handling any errors that occur in
the database. Another advantage of triggers is: Any table that is present in a PostgreSQL database can be forced
to receive security approvals with the use of PostgreSQL triggers.
22. Is PostgreSQL compatible with Cloud?

Yes, PostgreSQL is compatible and be run on Cloud. PostgreSQL is highly portable. Moreover, similar to other
open-source databases, PostgreSQL can be effortlessly executed on virtual containers.

23. State the maximum size of a table on PostgreSQL.

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.

24. What are the differences between PostgreSQL and MongoDB?


PostgreSQL MongoDB
PostgreSQL is a relational database management MongoDB is a non-relational database management
system. system.
PostgreSQL was created using the C language. MongoDB was created using the C++ language.
PostgreSQL is object-oriented.
MongoDB is document-oriented.

PostgreSQL stores data in the form of different MongoDB stores data in the form of key-value pairs as one
tables. record.
PostgreSQL is faster than MongoDB. MongoDB is relatively slower than PostgreSQL.

25. State the role of tokens in PostgreSQL.

Tokens can be represented as anything from an identifier and keyword to a literal symbol or a special character
symbol. Tokens are regarded as the building blocks of every source code. They are usually separated by a tab,
space, or a new line.

26. When should a developer use PostgreSQL?

Its open-source feature makes PostgreSQL an amazing option for both business and personal projects.

It is a great tool for developers when their preferences include:

 Protecting data integrity.


 Creating environments that are fault-tolerant.
 Solving complex problems.
 Needing a technology that is easily compatible with different operating systems and programming
languages.

27. Describe the history of PostgreSQL in brief.

PostgreSQL was created as a component of the POSTGRES project that was led by Professor Michael
Stonebraker in 1986, at the University of California, Berkeley. It is compatible with all of the popular operating
systems like macOS, Windows, Linux, and UNIX. PostgreSQL has supported ACID properties since 2001. It
has been actively developed on the core platform for more than 30 years.

It has additional features including the PostGIS database extender. Postgresql is the standard database for MAC
OS. The Post Ingres project was developed by Michel Stonebraker, the creator of Postgresql, to support modern
Database systems. Due to the widespread support for the SQL Standard among most relational databases,
PostgreSQL is commonly referred to as Postgres.

28. List the disadvantages of PostgreSQL.

Despite its many advantages, PostgreSQL has numerous disadvantages. Some of these include:

 It has a relatively lower speed as compared to MySQL.


 It supports lesser open-source applications as compared to MySQL.
 Since it is not owned by any one specific organization, it has faced challenges getting its name out in the
market.
 Its performance rate might be lower than that of MySQL.

To know what are the differences between the popular databases i.e. Postgresql vs MySQL.

29. 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 key automatically.

A sequence in PostgreSQL can be defined as a user-defined schema-bound object that generates an integer
sequence based on a specific requirement.

30. How can you take the backup of a database?

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:
pg_dump database_name > filename.sql

The database can be reconstructed using the commands available in the SQL file.

Another way to backup the database is:


/usr/local/bin/pg_dump mydatabase > mydatabase.pgdump

Advanced PostgreSQL Interview Questions and Answers for


Experienced
31. Explain the procedure to set up PgAdmin in PostgreSQL.

PgAdmin is a web-based management tool that interacts with the PostgreSQL database. It can be used to
perform any database administration operations on PostgreSQL.

To set up PgAdmin in PostgreSQL, follow these steps:

 Start and launch pgAdmin 4.


 Then select “Add new Server” from the “Quick Link” section under the “Dashboard” menu.
 Choose the “Connection” tab in the “Create-Server” box after clicking “Add new Server” in the
window.
 Put your server’s IP address in the “Hostname/Address” column to configure the connection.
 Finally, you must define “Port” as “5432,” which is the PostgreSQL server’s default port.

32. Differentiate between clustered and non-clustered indexes.


Clustered Index Non-Clustered Index
It is relatively slower as compared to the clustered
It is faster than the non-clustered index.
index.
In the case of a non-clustered index, the index is the
Index is considered the main data in the clustered index.
copy of data.
The clustered index has the ability to store data naturally The non-clustered index cannot naturally store data
on the disk. on the disk.
It requires lesser memory for operations as compared to The non-clustered index requires more memory to
the non-clustered index. perform operations.
A table can consist of only one clustered index. A table can contain multiple non-clustered indexes.

33. What is the procedure for storing binary data in PostgreSQL?

The users can store binary data in PostgreSQL in two distinct ways:

 By using the data type BYTEA.


 By using the Large Object feature.

34. What do you understand by the enable-debug command in PostgreSQL?

The enable-debug command in PostgreSQL is the command that assists in compiling all libraries and
applications.

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.

35. Describe the method by which you can change the column data type in PostgreSQL.

The data type of one or more columns in PostgreSQL can be changed by using the following commands along
with the TYPE keyword:

 ALTER TABLE
 ALTER COLUMN

Example:
ALTER TABLE tab_name
ALTER COLUMN col_name TYPE new_data_type;
36. Explain the role of table space in PostgreSQL.

Table spaces in PostgreSQL are defined as the directories where data files can be stored. They are used to store
various databases as well as database objects.

Using table spaces, the disk layout of a PostgreSQL installation can be easily handled and managed.

In addition to that, tablespaces give administrators the ability to enhance performance by making use of their
knowledge of the usage patterns of database objects.

37. How can the first 5 records be selected in PostgreSQL?

The LIMIT keyword can be used to select the first N records in PostgreSQL.

Example:
SELECT * FROM Employee ORDER BY Salary DESC LIMIT 5

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.

LIMIT keyword used with the number 5 prints the first 5 or the top 5 records present in the Employee table.

38. What are the features of PostgreSQL?

PostgreSQL or Postgres is an object-relational database management system or ORDBMS. Some of its


prominent features are as follows:-

 Extremely high fault-tolerance


 Free to download
 Reliable and secure
 Robust and powerful
 Easy recovery process
 Low maintenance cost
 Easily compatible with a wide variety of platforms and languages.
 High availability
 Easy to use

39. How can you stop a PostgreSQL Server? Can you stop a particular database in the
PostgreSQL cluster?

To stop a PostgreSQL server implement the following steps and commands:

 For Windows

The first step is to locate the PostgreSQL database directory.

After that, open the command prompt and execute the following command-
pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" stop

An alternative way to stop the PostgreSQL server on Windows is:


 Press the Windows key + R simultaneously to enter the Run Window.
 Type services.msc to find the PostgreSQL services.
 Using the installed version, locate the Postgres service.
 Click Stop to stop the database server.

 For Linux

Use the following command on Linux to stop the server-


sudo service postgresql stop

 For macOS

Use the following command on macOS to stop the server manually-


pg_ctl -D /usr/local/var/postgres stop

No, PostgreSQL does not allow the user to stop a specific database in the cluster.

40. Does PostgreSQL support Full-Text Search?

When a search is conducted on a portion of text contained in a large body of electronically recorded text, it is
referred to as a full-text search, and the results that are returned may include all or some of the search terms.
Traditional searches, however, would only produce exact matches.

Yes, PostgreSQL supports the Full-Text Search feature. It is a powerful tool in PostgreSQL and can be
enhanced by incorporating functions like result highlighting or by creating your own unique dictionaries or
functions.

1. What is the process of splitting a large table into smaller pieces called in PostgreSQL?

It is called table partitioning.

2. What is a partitioned table in PostgreSQL?

The partitioned table is a logical structure. It is used to split a large table into smaller pieces, which are called
partitions.

3. What purpose does pgAdmin in the PostgreSQL server have?

The pgAdmin in PostgreSQL is a data administration tool. It serves the purpose of retrieving, developing,
testing, and maintaining databases.

4. How can you avoid unnecessary locking of a database?

We can use MVCC (Multi-version concurrency control) to avoid unnecessary locking of a database.

5. What is PL/Python?

PL/Python is a procedural language to which PostgreSQL provides support.


6. Which are the methods PostgreSQL provides to create a new database?

PostgreSQL provides the following methods to create a new database:

 Using CREATE DATABASE, an SQL command

 Using created a command-line executable

7. How do you delete the database in PostgreSQL?

We can delete the database by using any one of the below options:

 Using DROP DATABASE, an SQL command

• Using dropdb a command-line executable

8. What does a schema contain?

A schema contains tables along with data types, views, indexes, operators, sequences, and functions.

9. What are the different operators in PostgreSQL?

The PostgreSQL operators include - Arithmetic operators, Comparison operators, Logical operators, and
Bitwise operators.

10. What are database callback functions called? What is its purpose?

The database callback functions are called PostgreSQL Triggers. When a specified database event occurs, the
PostgreSQL Triggers are performed or invoked automatically.

11. What indexes are used?

Indexes are used by the search engine to speed up data retrieval.

12. What does a Cluster index do?

Cluster index sorts table data rows based on their key values.

13. What are the benefits of specifying data types in columns while creating a table?

Some of these benefits include consistency, compactness, validation, and performance.

14. What do you need to do to update statistics in PostgreSQL?

To update statistics in PostgreSQL, we need to use a special function called a vacuum.

15. What is the disadvantage of the DROP TABLE command in deleting complete data from
an existing table?
Though the DROP TABLE command has the ability to delete complete data from an existing table, the
disadvantage with it is - it removes the complete table structure from the database. Due to this, we need to re-
create a table to store data.

16. How can you delete complete data from an existing table?

We can delete complete data from an existing table using the PostgreSQL TRUNCATE TABLE command.

17. What are the different properties of a transaction in PostgreSQL? Which acronym is used
to refer to them?

The properties of a transaction in PostgreSQL include Atomicity, Consistency, Isolation, and Durability. These
are referred to by the acronym, namely ACID.

18. What purpose does the CTIDs field serve?

The CTIDs field identifies the specific physical rows in a table according to their block and offsets positions in
that table.

19. Which are the commands used to control transactions in PostgreSQL?

The commands used to control transactions in PostgreSQL are BEGIN TRANSACTION, COMMIT, and
ROLLBACK.

20. What are the main differences between SQL and PostgreSQL?

PostgreSQL is an advanced version of SQL. Some of the differences between these two include the following:

 Unlike SQL, views in PostgreSQL are not updatable.

 Another difference is whereas SQL provides computed columns; the same cannot be expected from

PostgreSQL.

 Unlike SQL, in PostgreSQL, you don’t need to create a DLL to see the code what it is doing.

 PostgreSQL supports dynamic actions whereas SQL doesn’t support them.

21. How is security ensured in PostgreSQL?

PostgreSQL uses SSL connections to encrypt client or server communications so that security will be ensured.

22. What is the function of the Atomicity property in PostgreSQL?

Atomicity property ensures the successful completion of all the operations in a work unit.
23. What are the advantages of PostgreSQL?

Some of the advantages of PostgreSQL are open-source DBMS, community support, ACID compliance, diverse
indexing techniques, full-text search, a variety of replication methods, and diversified extension functions, etc.

24. What does Write-Ahead Logging do?

Write-Ahead Logging enhances database reliability by logging changes before any changes or updates are made
to the database

25. What are some of the important data administration tools supported by PostgreSQL?

Some of the important data administration tools supported by PostgreSQL are Psql, Pgadmin, and Phppgadmin.

26. How can you store the binary data in PostgreSQL?

We can store the binary data in PostgreSQL either by using bytes or by using the large object feature.

27. What is a non-clustered index?

In a non-clustered index, the index rows order doesn’t match the order in actual data.

28. What is the purpose of table space in PostgreSQL?

It is a location in the disk. In this, PostgreSQL stores the data files, which contain indices and tables, etc.

29. Are there any disadvantages with PostgreSQL?

Yes. There are a few disadvantages. Some of these include the following:

 It is slower than MySQL on the performance front.

 It doesn’t have the support of a good number of open-source applications when compared to MySQL.

 Since it focuses more on compatibility, changes made to improve the speed need more work.

30. What does a token represent in a SQL Statement?

In a SQL Statement, a token represents an identifier, keyword, quoted identifier, special character symbol, or
constant.

1. What does a PostgreSQL partitioned table look like?

The partitioned table is a logical structure. It is used to split a large table into smaller pieces, which are called
partitions.

2. How can you avoid locking a database unnecessarily?

We can use MVCC (Multi-version concurrency control) to avoid unnecessary locking of a database.
3. What purpose does pgAdmin serve in PostgreSQL?

The pgAdmin in PostgreSQL is a data administration tool. It serves the purpose of retrieving, developing,
testing, and maintaining databases.

4. What is the PostgreSQL feature called that splits a large table into smaller pieces?

It is called table partitioning.

5. What do you know about PL/Python?

PL/Python is a procedural language to which PostgreSQL provides support.

6. What methods does PostgreSQL provide to create a new database?

PostgreSQL provides the following methods to create a new database:

1. Using CREATE DATABASE, an SQL command


2. Using created a command-line executable

7. What would be the most important pieces of information you would want to include in a
schema?

A schema contains tables along with data types, views, indexes, operators, sequences, and functions.

8. What are some of the different operators in PostgreSQL?

The PostgreSQL operators include: Arithmetic operators, Comparison operators, Logical operators, and Bitwise
operators.

9. How can you delete a PostgreSQL database?

We can delete the database by using any one of the below options:

 Using DROP DATABASE, an SQL command


 Using dropdb a command-line executable

10. What do you think indexes are used for?

Indexes are used by the search engine to speed up data retrieval.

11. What do you think is a Cluster index's purpose?

Cluster index sorts table data rows based on their key values.

12. What do you think are database call back functions? How do they help your application?

The database call back functions are called PostgreSQL Triggers. When a specified database event occurs, the
PostgreSQL Triggers are performed or invoked automatically.
13. What are the benefits of specifying data types in columns while creating a table?

Some of these benefits include consistency, compactness, validation, and performance.

14. What do you need to do to update statistics in PostgreSQL?

To update statistics in PostgreSQL, we need to use a special function called a vacuum.

15. What do you think is the disadvantage of the DROP TABLE command?

Though the DROP TABLE command has the ability to delete complete data from an existing table, the
disadvantage with it is: it removes complete table structure from the database. Due to this, we need to re-create
a table to store data.

16. How can you completely delete a table?

We can delete complete data from an existing table using the PostgreSQL TRUNCATE TABLE command.

17. What are the different properties of a transaction in PostgreSQL? Which acronym is used
to refer to them?

The properties of a transaction in PostgreSQL include Atomicity, Consistency, Isolation, and Durability. These
are referred to by the acronym, namely ACID.

18. What purpose does the CTIDs field serve?

The CTIDs field identifies the specific physical rows in a table according to their block and offsets positions in
that table.

19. Which are the commands used to control transactions in PostgreSQL?

The commands used to control transactions in PostgreSQL are BEGIN TRANSACTION, COMMIT, and
ROLLBACK.

20. What are the main differences between SQL and PostgreSQL?

PostgreSQL is an advanced version of SQL. Some of the differences between these two include the following:

 Unlike SQL, views in PostgreSQL are not updatable.


 Another difference is that SQL provides computed columns; the same cannot be expected from PostgreSQL.
 Unlike SQL, in PostgreSQL, you don’t need to create a DLL to see what the code is doing.
 PostgreSQL supports dynamic actions whereas SQL doesn’t support them.

21. How is security ensured in PostgreSQL?

PostgreSQL uses SSL connections to encrypt client or server communications so that security will be ensured.

22. What is the function of the Atomicity property in PostgreSQL?

Atomicity property ensures the successful completion of all the operations in a work unit.
23. What do you think are some of the advantages of using PostgreSQL?

Some of the advantages of PostgreSQL are open-source DBMS, community support, ACID compliance, diverse
indexing techniques, full-text search, a variety of replication methods, and diversified extension functions, etc.

24. How does Write-Ahead Logging help you?

The Write-Ahead Logging enhances database reliability by logging changes before any changes or updates are
made to the database.

25. What are some of the important PostgreSQL administration tools?

Some of the important data administration tools supported by PostgreSQL are Psql, Pgadmin, and Phppgadmin.

26. How do you think you can store binary data in PostgreSQL?

We can store the binary data in PostgreSQL either by using bytes or by using the large object feature.

27. What do you think of the term "non-clustered index"?

In a non-clustered index, the index row order doesn’t match the order in actual data.

28. What purpose do you think table space serves in PostgreSQL?

It is a location in the disk. In this, PostgreSQL stores the data files, which contain indices and tables, etc.

29. Do you think there are any disadvantages with PostgreSQL?

Yes. There are a few disadvantages. Some of these include the following:

 It is slower than MySQL on the performance front.


 It doesn’t have the support of a good number of open source applications when compared to MySQL.
 Since it focuses more on compatibility, changes made to improve the speed need more work.

30. What does a token in a SQL statement represent?

In a SQL Statement, a token represents an identifier, keyword, quoted identifier, special character symbol, or a
constant.

31. What is the process of splitting a large table into smaller pieces called in PostgreSQL?

In PostgreSQL, the process of splitting a large table into smaller pieces is called table partitioning. It can be
done using several different methods, including range partitioning, list partitioning, and hash partitioning.

32. What are database callback functions called? What is its purpose?
Database callback functions are also known as database triggers. They are instructions automatically executed
in response to specific events on a database table, such as insert, update, or delete operations. The purpose of a
database trigger is to maintain data integrity, enforce business rules, and perform additional actions, such as
auditing or cascading updates.

33. What does a Cluster index do?

A clustered index organizes the data rows in a table based on the order of the indexed columns. This means the
rows with the same indexed values will be physically stored together on the storage media. This improves the
performance of queries that involve those indexed columns, as the database engine can retrieve the relevant data
faster.

34. What is PostgreSQL?

PostgreSQL is a free, open-source relational database management system (RDBMS) that emphasizes
extensibility and SQL compliance. It is known for its robust feature set, high performance, and reliability.

35. What are the most important features of PostgreSQL?

PostgreSQL is a powerful, open-source relational database management system known for its stability, data
integrity, and robust feature set. Some of its most important features include:

 ACID compliance
 Support for advanced data types and SQL
 Multi-version concurrency control (MVCC)
 Rich indexing options

36. What are the different data types used in PostgreSQL?

In PostgreSQL, several data types can be used, including integers , floating-point numbers, character and string
types, binary data, date and time types, and Boolean values.

37. What do you understand about a base directory in PostgreSQL?

In PostgreSQL, the base directory refers to the top-level directory where all data files for a specific database
cluster are stored. This includes subdirectories for each database within the cluster, as well as files containing
configuration settings and other metadata.

38. What do you understand about string constants in PostgreSQL?

In PostgreSQL, a string constant is a fixed sequence of characters that is enclosed in single quotes.

39. What is the maximum size for a table in PostgreSQL?

The size for a table in PostgreSQL is 32 terabytes.

40. What is Multi-Version Concurrency Control in PostgreSQL? Why is it used?

Multi-Version Concurrency Control (MVCC) is a technique used in PostgreSQL to allow multiple transactions
to access the same data simultaneously without conflicting with each other. It is used by creating a separate
version of a row for each transaction that modifies it.
41. What is the key difference between multi-version and lock models?

A multi-version model allows multiple versions of the same data to exist simultaneously, while a lock model
only allows one version of the data to exist at a time, and locks the data while it is being edited.

42. What are the Indices of PostgreSQL?

Indices in PostgreSQL are used to improve the performance of data retrieval operations by providing a faster
way to look up specific rows in a table.

43. What are the tokens in PostgreSQL?

In PostgreSQL, a token is a sequence of characters that represents a single syntactic element in a SQL query.
Tokens include keywords, operators, and identifiers, and are used by the PostgreSQL parser to understand the
structure and meaning of a query.

44. What are some new characteristics introduced in Postgre 9.1?

PostgreSQL 9.1 introduced several new features, including support for parallel query execution, improved
indexing options, and support for replication slots. It also added support for unlogged tables and improved
support for JSON data types.

45. What do you know about the history of PostgreSQL?

PostgreSQL was first released in 1996. It was developed at the University of California, Berkeley as a part of
the Postgres project, and is the most popular open-source database in use today.

46. How can you start, stop, and restart the PostgreSQL server on Windows?

To start, stop, and restart the PostgreSQL server on Windows, use the command "pg_ctl start/stop/restart -D
[data directory]" in the command prompt.

47. What is the difference between clustered index and non clustered index in PostgreSQL?

A clustered index helps in determining the physical order of data in a table, while a non-clustered index
provides a faster way to look up data without affecting the physical order of the table in PostgreSQL.

48. What is the difference between PostgreSQL and MongoDB databases?

PostgreSQL is a RDBMS while MongoDB is a document-oriented NoSQL database.

49. What do you understand about parallel queries in PostgreSQL? How does it work?

Parallel query in PostgreSQL is a feature that allows multiple parallel worker processes to work on a single
query to improve performance and speed up query execution time by breaking down the query into smaller
parts and processing them in parallel.

50. What is the use of command enable-debug in PostgreSQL?


The "enable_debug" command in PostgreSQL is used to enable or disable debugging output for various
subsystems of the database system.

51. What are the reserved words in PostgreSQL?

The reserved words in PostgreSQL are keywords that have a special meaning in the SQL language and cannot
be used as identifiers (such as table or column names) without being quoted.

52. What is tablespace in PostgreSQL? What is its usage?

A tablespace in PostgreSQL is a location on disk where data files of specific tables or indexes can be stored,
allowing for more control over disk usage and file placement.

53. What are the three phenomena that must be prevented between concurrent transactions
in PostgreSQL?

The three phenomena that must be prevented between concurrent transactions in PostgreSQL are lost updates,
dirty reads, and inconsistent reads.

54. What are the key differences between Oracle and PostgreSQL?

Oracle is a proprietary database management system while PostgreSQL is open-source

55. What do you understand about a sequence in PostgreSQL?

A sequence in PostgreSQL is a database object that generates a sequence of unique integers, which can be used
as the default value for a column or as part of a primary key.

56. What do you understand about the inverted file in PostgreSQL?

An inverted file in PostgreSQL is a data structure used to efficiently search and retrieve data from a table or
index by mapping terms or keywords to the corresponding rows or documents in which they appear.

You might also like