Hans-Jurgen Schonig

Hans-Jurgen Schonig has been in the PostgreSQL business since 2000. His company, Cybertec Schonig & Schonig GmbH (http://www.postgresql-support.de), serves clients around the globe, providing 24/7 support, replication, development, consulting, and training. He has written numerous books on PostgreSQL.

Quotes

Maryna Lysenko 💙💛has quotedlast year
The table has grown considerably, even though the data inside the table is exactly the same. The reason for this problem is called alignment and can be found deep inside the code. The theory is as follows: a CPU has a hard time if a field does not start at a multiplier of CPU word-size. Therefore, PostgreSQL will accordingly align data physically.
The most important point here is that it can make sense to group columns with similar data types next to each other. Of course, the outcome and the potential difference in size greatly depend on the content. If "abc" was used instead of "abcd" in this example, the results would not have shown any difference; both versions of the table would have had a fixed size of 498 MB.
Maryna Lysenko 💙💛has quotedlast year
table in PostgreSQL can hold up to 1600 columns
Maryna Lysenko 💙💛has quotedlast year
SELECT schemaname, relname, seq_scan, seq_tup_read,
idx_scan, seq_tup_read / seq_scan
FROM pg_stat_user_tables
WHERE seq_scan > 0
ORDER BY seq_tup_read DESC;
The query provides us with schemaname and relname to identify the table inside the database. The seq_scan field will return the number of times the table has been read sequentially. During those sequential scans, the database had to read seq_tup_read rows. The idx_scan field informs us about the number of index scans, and finally, the average number of rows needed by seq_scan is displayed.

Impressions

Maryna Lysenko 💙💛shared an impressionlast year
👍Worth reading

  • Hans-Jurgen Schonig
    Troubleshooting PostgreSQL
    • 3
    • 11
    • 1
    • 1
    Books
  • fb2epub
    Drag & drop your files (not more than 5 at once)