Module2_System_architecture Flashcards

1
Q

what is the first process that starts when you start postgresql?

A

postmaster and is a superviser for all other postgres processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the functions of postmaster process?

A
  • it starts all other postgresql processes and restarts them if they die.
  • it listens to new connections and setups up a new dedicated process per user connection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what 3 items sit in shared memory

A

shared buffers, wal buffer and process array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is background writer?

A

ensure enough buffer supply available in the memory and sync from time to time dirty data blocks to data files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does the checkpointer?

A

checkpointer writes the buffers by default every 5 min (checkpoint timeout parameter) to data files or
when WAL is full Parameter (MAX_WAL_SIZE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the WAL Writer?

A

ensuring data wall buffers are synced with disk at commit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does the logger processes do?

A

Routes log messages to syslog, eventlog or log files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does archiver proces do?

A

Copy the switched wal file to an archived wall destination. not started by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does autovacuum LAUNCHER process do?

A

autolauncher proces manages and starts autovacuum processes that do maintaince tasks like vacuming and analyse.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does stats collector proces do?

A

collect stats and store them in the DB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what does logical replication process do?

A

Launces the processes to perform logical replication based on the data he retrieved from WAL segments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what does the autovacuum WORKER process

A

recover free space for reuse.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How is shared buffer used for READING:

A

If a new user connection asks for data that is present in the shared buffer the user will get the data fast because it already lookup once before. If the query is not executed before it will be fetched from disk and loaded into shared data (slow) and results can be given to the user. The result of that query will stay in memory so the next request will be fast as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is shared buffer used for WRITING:

A

When user alters data and does a commit it will be written in the shared buffer ONLY! after a checkpoint (because of time default 5 min or when WAL is full) data will be written to disk by checkpointer proces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is background writer cleaning scan

A

BGWriter performing cleaning scans to ensure there is enough supply of clean buffers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is Write Ahead Logging (WAL)

A

WAL is used to track transactions. when user commits data it will be written from wal buffer inside shared memory to WAL file on disk by the WAL Writer. It will only give the user the commit succeeded after it’s written in transaction log (WAL file).

17
Q

Transaction log archiving.

A

Archiver process starts process to copy the switched WAL (PG_WAL log files) to a archiver destination for PIR. The archiver runs the ARCHIVE_COMMAND on the OS the copy the files.

18
Q

where is the altered data before commit?

A

uncommited updates are in memory

19
Q

where is the altered data after commit?

A

WAL buffers are writen to disk (wal file) and shared buffers are markerd as commited.

20
Q

where is the altered data after checkpoint?

A

altered data pages are written from shared memory to data files.

21
Q

what process acts as the listener?

A

postmaster and listens on 1 port only

22
Q

what happens after Postmaster listenens to a new connection

A

it will start a new dedicated processes voor that connection and perform authentication. after autentication is succes Postmaster will handover that new proceses to the requesting user.

23
Q

statement proces has 3 functions

A

Parsing the query, optimizing (find plan with lowest cost) and executed based on the optimized plan .

24
Q

what is a cluster?

A

collection of databases managed by one instance with a seperate data directory, TCP Port and set of processes.

25
Q

what is the default INSTALLATION directory op postgres?

A

/usr/pgsql-VERSION

has BIN, LIB en SHARE

26
Q

what is the default DATA directory op postgres?

A

/var/lib/pgsql/VERSION/data

27
Q

what is in the GLOBAL directory?

A

cluster wide database objects like Data dictionary and user information. database information

28
Q

What is in the BASE directory?

A

Data of the databases. a directory per database.

29
Q

what is in the PG_TBLSC directory?

A

Symbolink links to tablespace location.

30
Q

what is in the pg_wal directory?

A

the location of WAL files.

31
Q

what is in the LOG directory?

A

error files

32
Q

What is the pg_ident.conf file?

A

This file controls PostgreSQL user name mapping. It maps external
user names to their corresponding PostgreSQL user names. Records
are of the form:

33
Q

what is the order of loading config files when starting instance.

A

first loads the postgresql.conf and then postgresql.auto.conf on top of it.

34
Q

what are the postmaster configuation files?

A

postmaster. pid where it stores the postmaster ID

postmaster. opts where it loads the postmaster startup OPTIONS

35
Q

how many files are table or index

A

every table or index has its own datafile and gets default 1GB chunk.

36
Q

what is a tablespace

A

is a directory.

37
Q

how can i find the file on disk that matches my table

A
pg_class.relfilenode
select pg_relation_filepath ('TABLE_NAME');
38
Q

what are 5 things in a page?

A

page header: General info about page,pointers to free space,24 bytes long
row/index pointers: 4 bytes per item, array of offset/lengt pointing to the actual rows/index entries
free space: unallocated free space
row/index entry: actual data or index entry
special: index access method specific data (empty in ordinary tables)