Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of...
Transcript of Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of...
![Page 1: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/1.jpg)
1
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” ShulginZalando SE
[email protected] 2016
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 2: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/2.jpg)
2
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
The Flipping Plan Problem
Deep Dive into Code
A Bird Eye’s View
Solution?
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 3: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/3.jpg)
3
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 4: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/4.jpg)
4
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
• pg_statistic
• pg_stats
• MCV: =, <, >
• hist: <, >
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
schemaname | name | tablename | name | attname | name | inherited | boolean | null_frac | real | avg_width | integer | n_distinct | real | most_common_vals | anyarray | most_common_freqs | real[] | histogram_bounds | anyarray | correlation | real | most_common_elems | anyarray | most_common_elem_freqs | real[] | elem_count_histogram | real[] |
len(mcv) ≤ statistics_target
![Page 5: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/5.jpg)
5
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
The Flipping Plan Problem
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 6: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/6.jpg)
6
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
SELECT * FROM print_list JOIN ... JOIN ... WHERE status = 'NOT_YET_PRINTED';
-> Index Scan using print_list_status_idx on print_list
(cost=0.27..1138.53 rows=6073 width=56)
(actual time=0.727..0.727 rows=0 loops=1)
-> Seq Scan (OMG!)
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 7: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/7.jpg)
7
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box most_common_vals | {PRINTED,PREPARED,ERROR} -- 2+ “ERROR”
most_common_freqs | {0.996567,0.002853,6.66667e-05} histogram_bounds |
most_common_vals | {PRINTED,PREPARED} -- 0 “ERROR” most_common_freqs | {0.996543,0.003457} histogram_bounds |
most_common_vals | {PRINTED} -- 1 “ERROR” most_common_freqs | {0.997102} histogram_bounds | {PREPARED,ERROR}
status | count | sample (expectation)----------------+---------+-------- PRINTED | 3551367 | 29914 PREPARED | 10162 | 85 ERROR | 159 | 1 <====== this* TO_BE_PREPARED | 2 | 0
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 8: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/8.jpg)
8
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 9: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/9.jpg)
9
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
operator <
![Page 10: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/10.jpg)
10
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 11: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/11.jpg)
11
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 12: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/12.jpg)
12
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 13: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/13.jpg)
13
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
MCVs Histogram
![Page 14: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/14.jpg)
14
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
4 MCVs 1 MCV 2 MCVs
![Page 15: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/15.jpg)
15
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
The Flipping Plan Problem
Deep Dive into Code
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 16: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/16.jpg)
16
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
mincount = ...
for (i = 0; i < num_mcv; i++){if (track[i].count < mincount){
num_mcv = i;break;
}}
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 17: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/17.jpg)
17
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
mincount = ...
for (i = 0; i < num_mcv; i++){if (track[i].count < mincount){
num_mcv = i;break;
}}
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 18: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/18.jpg)
18
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
for (i = 0; i < num_mcv; i++){mincount = ...if (track[i].count < mincount){
num_mcv = i;break;
}}
// i = 1
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 19: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/19.jpg)
19
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
for (i = 0; i < num_mcv; i++){mincount = ...if (track[i].count < mincount){
num_mcv = i;break;
}}
// i = 2
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 20: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/20.jpg)
20
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
The Flipping Plan Problem
Deep Dive into Code
A Bird Eye’s View
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 21: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/21.jpg)
21
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH stats1 AS ( SELECT *, current_setting('default_statistics_target')::int AS stats_target,
array_length(most_common_vals,1) AS num_mcv, (SELECT SUM(f) FROM UNNEST(most_common_freqs) AS f) AS mcv_frac,
array_length(histogram_bounds,1) AS num_hist, (SELECT COUNT(DISTINCT h) FROM UNNEST(histogram_bounds::text::text[]) AS h) AS distinct_hist
FROM pg_stats WHERE schemaname NOT IN ('pg_catalog', 'information_schema')),stats2 AS ( SELECT *, distinct_hist::real/num_hist AS hist_ratio FROM stats1)
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 22: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/22.jpg)
22
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
most_common_vals | {101,100}most_common_freqs | {0.806367,0.1773}hist_ratio | 0.214286histogram_bounds | {202,202,202,202,202,202,202,202,202,3001,302,302,302, 302,302,302,302,302,302,302,302,3031,3185,502,502,502, 502,502}
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box“Before”
most_common_vals | {101,100,302,202,502,3001,3059,3029,3031,3140,3041,3095, 3100,3102,3192}most_common_freqs | {0.803933,0.179,0.00656667,0.00526667,0.00356667, 0.000333333,0.000133333,0.0001,0.0001,0.0001,...}hist_ratio | 1histogram_bounds | {3007,3011,3027,3056,3067,3073,3084,3087,3088,3106,3107, 3118,3134,3163,3204,3225,3247}
“After”
![Page 23: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/23.jpg)
23
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(hist_ratio)::real, avg(hist_ratio)::real, max(hist_ratio)::real, stddev(hist_ratio)::real FROM stats2 WHERE histogram_bounds IS NOT NULL;
count | 21335min | 0.176471avg | 0.939104max | 1stddev | 0.14548
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(hist_ratio)::real, avg(hist_ratio)::real, max(hist_ratio)::real, stddev(hist_ratio)::real FROM stats2 WHERE distinct_hist < num_hist;
count | 4128min | 0.176471avg | 0.686448max | 0.990099stddev | 0.172547
“Before”
![Page 24: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/24.jpg)
24
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(hist_ratio)::real, avg(hist_ratio)::real, max(hist_ratio)::real, stddev(hist_ratio)::real FROM stats2 WHERE histogram_bounds IS NOT NULL;
count | 18314min | 0.448276avg | 0.988884max | 1stddev | 0.052899
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(hist_ratio)::real, avg(hist_ratio)::real, max(hist_ratio)::real, stddev(hist_ratio)::real FROM stats2 WHERE distinct_hist < num_hist;
count | 1095 (was 4128)min | 0.448276 (was 0.176471)avg | 0.81408 (was 0.686448)max | 0.990099stddev | 0.119637
“After”
![Page 25: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/25.jpg)
25
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 26: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/26.jpg)
26
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(num_mcv)::real, avg(num_mcv)::real, max(num_mcv)::real, stddev(num_mcv)::real FROM stats2 WHERE num_mcv IS NOT NULL;
count | 27452min | 1avg | 32.7115max | 100stddev | 40.6927
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(num_mcv)::real, avg(num_mcv)::real, max(num_mcv)::real, stddev(num_mcv)::real FROM stats2 WHERE num_mcv < 100;
count | 20980min | 1avg | 11.9541max | 99stddev | 18.4132
“Before”
![Page 27: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/27.jpg)
27
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(num_mcv)::real, avg(num_mcv)::real, max(num_mcv)::real, stddev(num_mcv)::real FROM stats2 WHERE num_mcv IS NOT NULL;
count | 27527min | 1avg | 38.4341 (was 32.7115)max | 100stddev | 43.3596
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
WITH ...SELECT count(1), min(num_mcv)::real, avg(num_mcv)::real, max(num_mcv)::real, stddev(num_mcv)::real FROM stats2 WHERE num_mcv < 100;
count | 19329min | 1avg | 12.3222 (was 11.9541)max | 99stddev | 19.6959
“After”
![Page 28: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/28.jpg)
28
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
Statistics: What? Where? Why?
The Flipping Plan Problem
Deep Dive into Code
A Bird Eye’s View
Solution?
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
![Page 29: Dark Corners of PostgreSQL Statistics Analyzer Corners of... · 2019-10-10 · Dark Corners of PostgreSQL box Statistics Analyzer Oleksandr “Alex” Shulgin Zalando SE oleksandr.shulgin@zalando.de](https://reader034.fdocuments.us/reader034/viewer/2022042220/5ec6d62605be9735375f3049/html5/thumbnails/29.jpg)
29
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box
References● pgsql-hackers thread (the patch)● pgsql-performance thread (flipping plan)● commitfest entry
Dark Corners of PostgreSQL Statistics Analyzer
Oleksandr “Alex” Shulgin - PGDay.ru 2016
Please write the title in all capital letters
Use bullet points to summarize information rather than writing long paragraphs in the text box