ADC Theory
ADC Theory
Ans: /var/lib/postgresql/14/main/base/
2. What is a cluster?
Ans: A database cluster is a collection of databases that is managed by a single instance of
a running database server.
6. pg_class, pg_attribute.
Ans: pg_class is an internal system table that stores information about tables (and similar
objects") available in the database. Every database product has such a collection of system
tables (and views) that it maintains.
The catalogue pg_attribute stores information about table columns. There will be exactly one
pg_attribute row for every column in every table in the database.
7. When we start our machine. How many postgres processes are running?
Ans: 6+1
8. pg_database.
Ans: Catalog table that stores pg_database information about available databases.
10. What are the uses of default databases in pg_databases such as template1,
template0.
Ans: template1 is the one used by default. You can alter / add / remove objects there to
affect every newly created DB
11. relowner is the id of owner; select relname,relowner from pg_class where relname =
'x'; select *from pg_user;
Ans: in pg_class every relation(table) has relowner which is the id of the user who created
that relation. The relowner id is nothing but usesysid from pg_user.
12. What are some default pg_attributes that come with every table but our default.
Ans: cmax,cmin,xmax,xmin,tableoid
17. \explain
Ans: It returns the execution plan generated by PostgreSQL query planner for a
given statement.
Syntax
The syntax for granting privileges on a table in PostgreSQL is:
GRANT privileges ON object TO user;
24. \dS+ tableName
Ans: Displays sequences.
26. \h set
Ans: set command is used to change run time parameter. For e,g set search_path.
30. TOAST : table of oversized attribute storage. That compression mechanism is called
as toast.
33. initdb creates a new PostgreSQL database cluster. A database cluster is a collection
of databases that are managed by a single server instance.
Ans: initdb creates a new PostgreSQL database cluster. A database cluster is a collection
of databases that are managed by a single server instance.
This mode also blocks concurrent ACCESS EXCLUSIVE MODE locks from being
acquired on the same table.
The ROW SHARE MODE lock is acquired automatically by a SELECT statement that
has a FOR UPDATE clause. It blocks ALTER TABLE, DROP TABLE, and VACUUM
commands on the table on which it is acquired.
This mode also blocks concurrent EXCLUSIVE MODE and ACCESS EXCLUSIVE MODE
locks from being acquired on the same table.
select
select for update
select for shared
update,delete,insert
vaccum(without full),analyze, create index,alter table(with validation)
with concurrency,w
materialized view
drop table,truncate,reindex,vaccum(full),alter tale(add column),alter table(drop column).
45. View
Ans: https://www.tutorialspoint.com/postgresql/postgresql_views.htm