PGSession - 21 Novembre 2019
(Pierre Giraud)
Il était une fois…
Limit (cost=1.27..3878.21 rows=5 width=172) (actual time=0.245..2.544 rows=5 loops=1)
-> Nested Loop (cost=1.27..48075.41 rows=62 width=172) (actual time=0.244..2.539 rows=5 loops=1)
-> Nested Loop (cost=0.84..2420.02 rows=65 width=85) (actual time=0.137..0.151 rows=5 loops=1)
-> Nested Loop (cost=0.42..2356.20 rows=5 width=85) (actual time=0.118..0.119 rows=1 loops=1)
-> Seq Scan on top_challenge_list (cost=0.00..30.26 rows=58 width=57) (actual time=0.036..0.043 rows=4 loops=1)
Filter: (is_active AND ((template_challenge)::text = 'top_turnover'::text))
Rows Removed by Filter: 26
-> Index Scan using ref_people_xperf1 on ref_people (cost=0.42..40.09 rows=1 width=28) (actual time=0.017..0.017 rows=0 loops=4)
Index Cond: (id_int = top_challenge_list.id_int_manager)
Filter: (is_active AND (id_statut <> 2) AND (COALESCE(id_qualification, 1) >= 1) AND (id_type = 5))
Rows Removed by Filter: 4
-> Index Scan using ref_genealogy_xperf5 on ref_genealogy (cost=0.42..12.56 rows=20 width=8) (actual time=0.017..0.026 rows=5 loops=1)
Index Cond: (id_int = ref_people.id_int)
Filter: is_active
-> Index Scan using ref_people_xperf1 on ref_people filleuls (cost=0.42..0.82 rows=1 width=47) (actual time=0.012..0.030 rows=1 loops=5)
Index Cond: (id_int = ref_genealogy.id_int_level)
Filter: (is_active AND (id_type = ANY ('{5,14}'::integer[])))
Rows Removed by Filter: 7
SubPlan 1
-> Aggregate (cost=361.46..361.47 rows=1 width=8) (actual time=0.233..0.233 rows=1 loops=5)
-> Index Scan using ref_transaction_xperf4 on ref_transaction (cost=0.42..361.46 rows=1 width=8) (actual time=0.155..0.229 rows=0 loops=5)
Index Cond: (id_int_agent_out = filleuls.id_int)
Filter: (is_active AND (date_acte IS NOT NULL) AND (date_acte >= top_challenge_list.date_deb_challenge) AND (date_acte <= top_challenge_list.date_fin_challenge) AND (id_type_transaction = 1))
Rows Removed by Filter: 100
SubPlan 2
-> Aggregate (cost=373.99..374.00 rows=1 width=8) (actual time=0.177..0.178 rows=1 loops=5)
-> Index Scan using ref_transaction_xperf3 on ref_transaction ref_transaction_1 (cost=0.42..373.99 rows=1 width=8) (actual time=0.117..0.174 rows=0 loops=5)
Index Cond: (id_int_agent_in = filleuls.id_int)
Filter: (is_active AND (date_acte IS NOT NULL) AND (date_acte >= top_challenge_list.date_deb_challenge) AND (date_acte <= top_challenge_list.date_fin_challenge) AND (id_type_transaction = 1))
Rows Removed by Filter: 102
Planning Time: 2.916 ms
Execution Time: 2.900 ms
Pas facile à lire, hein ?

Seulement voilà…

Seulement voilà…
POC réécriture de PEV
➜ très rapide car code bien écrit

“ Si c’est pas capable de lire un plan au format TEXT, j’m’en servirai pas. ”




(PEV était limité aux superlatifs)


(résumé)

Application de démo dans le dépôt github.
fonctionne dans le navigateur, pas de rétention

Brought to you with ♥ by Dalibo ;-)

Vous pouvez envoyer vos plans en POST.
$ curl -Ls -w %{url_effective} -d '{"plan":"Result (cost=0.00..0.01 rows=1 width=32)"}'
-H "Content-Type: application/json" -X POST https://explain.dalibo.com/new
-o /dev/null | xargs xdg-open
Diagramme (vue synthétique)

Feedbacks and contributions are welcome!
Pierre Giraud
DALIBO