зеркало из
https://github.com/iharh/notes.git
synced 2025-10-29 12:46:06 +02:00
m
Этот коммит содержится в:
родитель
807fe7547d
Коммит
693ae63ddb
@ -1,6 +1,8 @@
|
||||
https://speakerdeck.com/pgpro
|
||||
|
||||
2024
|
||||
Tenzor - Borovikov - Useful SQL Constructions in PG 0:00 of 58:01
|
||||
https://www.youtube.com/watch?v=nf3b2QmG_jA
|
||||
YandexForBackend - Valkov - PG for Java Developer 25:00 of 44:21
|
||||
https://www.youtube.com/watch?v=QzIUHvDnEaI
|
||||
! 13:00 - Hikary Cfg (timeouts)
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
2024
|
||||
AzatYakupov - BTree Index in PG 0:00 of 1:09:10
|
||||
https://www.youtube.com/watch?v=hMoBH7drftk
|
||||
JPoint - Salnikov - PostgreSQL Indices ru 0:00 of 2:00:44
|
||||
https://www.youtube.com/watch?v=ju9F8OvnL4E
|
||||
https://squidex.jugru.team/api/assets/srm/5a15546d-af53-46d4-be84-63367a5aaaf3/jpoint2022.andrei-.salsnikov.pdf
|
||||
2023
|
||||
JPoint - Sitnikov - B-Tree indices using Boot, PostgreSQL, JPA 18:00 of 45:07
|
||||
https://www.youtube.com/watch?v=y-Wtyvme4gE
|
||||
! using indices improves search-perf, but degrades ins/upd perf
|
||||
! indices have types
|
||||
! 21:30 explain (analyze, costs off, buffers) -- buffers is aprox about num of disk ops
|
||||
2017
|
||||
BartunovKorotkov - All truth about Indices 0:00 of 46:35
|
||||
https://www.youtube.com/watch?v=aaecM4wKdhY
|
||||
@ -1,6 +0,0 @@
|
||||
2024
|
||||
https://habr.com/ru/articles/830924/
|
||||
https://habr.com/ru/articles/815323/
|
||||
https://habr.com/ru/articles/813781/
|
||||
2023
|
||||
https://habr.com/ru/post/696274/
|
||||
9
db/sql/postgres/feature/internals/docs/articles.txt
Обычный файл
9
db/sql/postgres/feature/internals/docs/articles.txt
Обычный файл
@ -0,0 +1,9 @@
|
||||
2024
|
||||
pg16 - p3 - pages/buffers and versions of rows p3
|
||||
https://habr.com/ru/articles/830924/
|
||||
pg16 - p2 - transaction isolation
|
||||
https://habr.com/ru/articles/815323/
|
||||
pg16 - p1 - data organisation
|
||||
https://habr.com/ru/articles/813781/
|
||||
2023
|
||||
https://habr.com/ru/post/696274/
|
||||
1
db/sql/postgres/feature/internals/docs/blogs.txt
Обычный файл
1
db/sql/postgres/feature/internals/docs/blogs.txt
Обычный файл
@ -0,0 +1 @@
|
||||
https://stormatics.tech/our-blogs
|
||||
3
db/sql/postgres/feature/internals/docs/books.txt
Обычный файл
3
db/sql/postgres/feature/internals/docs/books.txt
Обычный файл
@ -0,0 +1,3 @@
|
||||
2024
|
||||
Lisovskiy - Statistics ru
|
||||
https://edu.postgrespro.ru/monitoring.pdf
|
||||
4
db/sql/postgres/feature/performance/docs/courses.txt
Обычный файл
4
db/sql/postgres/feature/performance/docs/courses.txt
Обычный файл
@ -0,0 +1,4 @@
|
||||
2023
|
||||
PostgresProfessional - RogovLuzanovTolmachyov - QPT13 - Query Optimization of p12
|
||||
https://postgrespro.ru/education/courses/QPT
|
||||
https://www.youtube.com/playlist?list=PLaFqU3KCWw6JW80WBHPOe-SMJD2NOjmge
|
||||
27
db/sql/postgres/feature/performance/docs/presentations.txt
Обычный файл
27
db/sql/postgres/feature/performance/docs/presentations.txt
Обычный файл
@ -0,0 +1,27 @@
|
||||
2024
|
||||
Digitalize - PG Optimization Basics 1:46:00 of 2:07:51
|
||||
https://www.youtube.com/watch?v=gA3A_epB3So
|
||||
! 13:00 - from index pages go into buffer-cache in RAM
|
||||
! 37:00 - select ... from employee e join contacts ec using(employee_id) -- on e.employee_id = ec.employee_id
|
||||
! 39:00 - data access methods: seq-scan, idx-scan(with going into table), index-only-scan(without going into table), bitmap-heap-scan
|
||||
! 45:00 - Seq Scan on employee (cost=0.00..173528.84 rows ...)
|
||||
! 0.00 - cost of first raw obtaining, 173528.84 - cost of all rows obtaining
|
||||
! 47:00 select relpages, current_setting('seq_page_cost'), relpages*current_setting('seq_page_cost')::int as total
|
||||
! from pg_class where relname='employee';
|
||||
! relpages: 73 530
|
||||
! current_setting: 1
|
||||
! total: 73 530
|
||||
! 53:00 selectivity (0.0 .. 1.0) - percentage/proportion of chosen rows
|
||||
! idx is effectively used only on low-selectivity, otherwise - seq scan
|
||||
! 1:08:00 - vacuum analyze - for updating statistics
|
||||
! 1:17:00 - create extension pg_stat_statements; alter system set shared_preload_libraries = 'pg_stat_statements';
|
||||
! 1:18:00 - other perf-related settings !!!
|
||||
! recommendation - https://www.youtube.com/playlist?list=PLaFqU3KCWw6JW80WBHPOe-SMJD2NOjmge
|
||||
JPoint - Zhilin - PG Can Make a Pain 0:00 of 45:49
|
||||
https://www.youtube.com/watch?v=pTWfjyeQ5Ks
|
||||
https://jokerconf.com/talks/0bd645ad3a0f48c292547db572a1c7eb
|
||||
WorkSolutions - Kostenko - Postgres World Optimization Misteries ru 0:00 of 32:50
|
||||
https://www.youtube.com/watch?v=MeTDmLyYD9k
|
||||
2023
|
||||
Tenzor - Backend School of p9
|
||||
https://www.youtube.com/playlist?list=PLt0vzWoDuwcTdFnp-QWtx2yEvKMDlPw7l
|
||||
@ -78,7 +78,9 @@ SELECT * FROM table WHERE email ILIKE ‘example@yandex.ru‘;
|
||||
|
||||
ILIKE является расширением оператора LIKE и не описан в стандарте SQL, это фишка PostgreSQL. ILIKE позволяет нам делать независимый от регистра поиск по заданному шаблону с учетом языковой среды, в которой установлена PostgreSQL. B-tree индекс не поддерживает данный оператор, так что в таком запросе индекс на поле email не будет использован.
|
||||
|
||||
Здесь мы рассмотрели варианты почему PostgreSQL НЕ МОЖЕТ использовать индекс, завтра мы с вами рассмотрим варианты, при которых PostgreSQL НЕ ХОЧЕТ использовать индекс, а предпочитать последовательное сканирование, или еще какие-то другие методы сканирования данных.************************************************************************************
|
||||
Здесь мы рассмотрели варианты почему PostgreSQL НЕ МОЖЕТ использовать индекс, завтра мы с вами рассмотрим варианты, при которых PostgreSQL НЕ ХОЧЕТ использовать индекс, а предпочитать последовательное сканирование, или еще какие-то другие методы сканирования данных.
|
||||
|
||||
************************************************************************************
|
||||
Захотели мы ускорить запрос, создали индекс по нужной колонке таблицы и успокоились. А PostgreSQL не использует, созданный нами индекс и продолжает делать последовательное сканирование по таблице, например. В этой серии постов попытаемся разобраться почему так может происходить.
|
||||
|
||||
В расследовании проблем с индексами лучший наш друг, это команда EXPLAIN. Она, конечно, не покажет нам точную причину неиспользования индекса PostgreSQL, но по крайней мере задаст направление, в котором нам следует производить расследование.
|
||||
1
db/sql/postgres/feature/performance/explain/analyze.txt
Обычный файл
1
db/sql/postgres/feature/performance/explain/analyze.txt
Обычный файл
@ -0,0 +1 @@
|
||||
https://www.postgresql.org/docs/current/sql-analyze.html
|
||||
@ -0,0 +1,5 @@
|
||||
2023
|
||||
Tenzor - Backend School p4 - Query Analysis p2 0:00 of 1:40:59
|
||||
https://www.youtube.com/watch?v=Rg7AAEso3z0
|
||||
Tenzor - Backend School p4 - Query Analysis p1 0:00 of 1:24:11
|
||||
https://www.youtube.com/watch?v=4g2CJv0jRk0
|
||||
28
db/sql/postgres/feature/performance/index/presentations.txt
Обычный файл
28
db/sql/postgres/feature/performance/index/presentations.txt
Обычный файл
@ -0,0 +1,28 @@
|
||||
2024
|
||||
AzatYakupov - BTree Index in PG 0:00 of 1:09:10
|
||||
https://www.youtube.com/watch?v=hMoBH7drftk
|
||||
JPoint - Salnikov - PostgreSQL Indices ru 0:00 of 2:00:44
|
||||
https://www.youtube.com/watch?v=ju9F8OvnL4E
|
||||
https://squidex.jugru.team/api/assets/srm/5a15546d-af53-46d4-be84-63367a5aaaf3/jpoint2022.andrei-.salsnikov.pdf
|
||||
2023
|
||||
JPoint - Sitnikov - B-Tree indices using Boot, PostgreSQL, JPA 18:00 of 45:07
|
||||
https://www.youtube.com/watch?v=y-Wtyvme4gE
|
||||
! using indices improves search-perf, but degrades ins/upd perf
|
||||
! indices have types
|
||||
! 21:30 explain (analyze, costs off, buffers) -- buffers is aprox about num of disk ops
|
||||
! b-tree index has nodes with like 100 children
|
||||
! 26:00 index only scan
|
||||
! Heap Fetches: 4 (pg went into table because of visibility/autovac)
|
||||
! 28:00 index on random uuid - will have more r/w
|
||||
! because of randomizeness (pg optimized insert of sequential values)
|
||||
! !!! UUID v7 can generate sequential ones
|
||||
! select ... from users where state = 'PENDING' and name = ?
|
||||
! create index state_name_users on users(name) include(state) -- idx will not sort by state, just include it
|
||||
! create index of (col1, col2) -- index sorted on combination of state, name
|
||||
Tenzor - Backend School - PG Indices p2 0:00 of 1:21:33
|
||||
https://www.youtube.com/watch?v=WTELBpLUb2E
|
||||
Tenzor - Backend School - PG Indices p1 0:00 of 1:10:44
|
||||
https://www.youtube.com/watch?v=sNCKlklvGO0
|
||||
2017
|
||||
BartunovKorotkov - All truth about Indices 0:00 of 46:35
|
||||
https://www.youtube.com/watch?v=aaecM4wKdhY
|
||||
@ -1,6 +0,0 @@
|
||||
2024
|
||||
JPoint - Zhilin - PG Can Make a Pain 0:00 of 45:49
|
||||
https://www.youtube.com/watch?v=pTWfjyeQ5Ks
|
||||
https://jokerconf.com/talks/0bd645ad3a0f48c292547db572a1c7eb
|
||||
WorkSolutions - Kostenko - Postgres World Optimization Misteries ru 0:00 of 32:50
|
||||
https://www.youtube.com/watch?v=MeTDmLyYD9k
|
||||
5
db/sql/postgres/feature/performance/tools/dalibo-pev2.txt
Обычный файл
5
db/sql/postgres/feature/performance/tools/dalibo-pev2.txt
Обычный файл
@ -0,0 +1,5 @@
|
||||
https://explain.dalibo.com/
|
||||
psql -XqAt -f explain.sql > analyze.json
|
||||
|
||||
https://github.com/dalibo/pev2
|
||||
https://github.com/AlexTatiyants/pev
|
||||
1
db/sql/postgres/feature/performance/tools/plan-exporter.txt
Обычный файл
1
db/sql/postgres/feature/performance/tools/plan-exporter.txt
Обычный файл
@ -0,0 +1 @@
|
||||
https://github.com/agneum/plan-exporter
|
||||
@ -6,6 +6,9 @@ https://www.citusdata.com/blog/2018/02/22/seven-tips-for-dealing-with-postgres-l
|
||||
https://habr.com/ru/company/otus/blog/452986/
|
||||
2015
|
||||
https://habrahabr.ru/company/postgrespro/blog/270827/
|
||||
2012
|
||||
https://www.youtube.com/watch?v=s3ee0nuDDqs
|
||||
https://momjian.us/main/writings/pgsql/locking.pdf
|
||||
|
||||
samples
|
||||
select ... for update;
|
||||
|
||||
7
science/ai/free/deepsek.txt
Обычный файл
7
science/ai/free/deepsek.txt
Обычный файл
@ -0,0 +1,7 @@
|
||||
https://www.deepseek.com/
|
||||
https://github.com/deepseek-ai
|
||||
https://api-docs.deepseek.com/quick_start/pricing
|
||||
|
||||
2025
|
||||
Makarov - DeepSeq v3 now free 0:00 of 6:29
|
||||
https://www.youtube.com/watch?v=cNXTGOy6FQQ
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user