Ihar Hancharenka 1b9d03d6ae m
2025-01-11 14:07:39 +03:00

58 строки
3.4 KiB
Plaintext

2023
Tenzor - Backend School p4 - Query Analysis p2 20:00 of 1:40:59
https://www.youtube.com/watch?v=Rg7AAEso3z0
! 5:00 - Custom Scan (<impl-method-name>)
! Recheck Cond - ???
! 7:00 - Beatmap Heap Scan
! exact ... lossy - not enough mem for gen full bitmap map
! 10:00 - Append + Unique (Sort Key:)
Tenzor - Backend School p4 - Query Analysis p1 9:00 of 1:24:11
https://www.youtube.com/watch?v=4g2CJv0jRk0
! 3:00 - by default PG does not get hints regarding plans
! 18:00 - explain(settings) select * from pg_class; -- to check current settings
! https://www.postgresql.org/docs/current/runtime-config.html
! 27:48 - if counts of planned and actual record does not near the same, most probably statistics is obsolete
! https://www.postgresql.org/docs/current/planner-stats.html
! https://www.postgresql.org/docs/current/runtime-config-autovacuum.html
! 30:32 !!! not enough statistics
! alter table ... alter column ... set statistics [0..10000] -- columns of hystogram (max 10000 per column)
! https://www.postgresql.org/docs/current/sql-createstatistics.html
! 39:00 - shared_buffers setting need to be increased if multiple clients get mostly the same data
! 43:00 - set io_track_timings=on; explain analyze ...
! 52:00 - ! rows removed by filter should be small
! 58.00 - https://www.postgresql.org/docs/current/storage.html
! 59.00 - https://www.postgresql.org/docs/current/storage-page-layout.html
! TID Scan - the dumbiest one
! Seq Scan - linear, dumb one
! Index Scan - smart
! Index Only Scan - smartest
! 1:09:00 - if Heap Fetches quite large, we made worse by this idx, compare to just "Index Scan"
! 1:13:00 - Foreign Scan - for tables on ext servers
2021
PGConf - Augustine - Deeper understanding of PG execution plan 26:00 of 47:55
https://www.youtube.com/watch?v=Ls-uE1V31lE
! 4:00 - debug_print_parse(boolean) - https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-DEBUG-PRINT-PARSE
! https://postgrespro.ru/docs/postgrespro/current/runtime-config-logging#GUC-DEBUG-PRINT-PARSE
! https://postgresqlco.nf/doc/en/param/debug_print_parse/
! !!! and other interesting stuff for debug printing
! 6:00 - pg_analyze_and_rewrite internal (c) func
! https://patshaughnessy.net/2014/10/13/following-a-select-statement-through-postgres-internals
! https://habr.com/ru/articles/304258/
! https://medium.com/@divya.n/how-postgres-works-733bc5cf61a
! https://github.com/melanieplageman/debugging_planner
! 7:00 - set log_parser_stats=on
! 11:00 - views are rules - pg_rewrite
! https://www.postgresql.org/docs/current/rules.html
! https://www.postgresql.org/docs/current/rules-views.html
! 13:00 - Paths - internal DS, used for plans
! 23:00 - Analyze
! autovacuum gathers stats
! pg_statistics, pg_stats,
! default_statistics_target
!!! https://postgrespro.ru/docs/postgresql/12/runtime-config-query#GUC-DEFAULT-STATISTICS-TARGET
! https://postgresqlco.nf/doc/en/param/default_statistics_target/
! https://postgrespro.ru/docs/postgrespro/current/catalog-pg-rewrite
! https://www.postgresql.org/docs/current/catalog-pg-rewrite.html
! https://dzone.com/articles/postgresql-rewrite-rules
! https://habr.com/ru/companies/first/articles/656673/