Re: [HACKERS] auto_explain : log queries with wrong estimation
От | Maksim Milyutin |
---|---|
Тема | Re: [HACKERS] auto_explain : log queries with wrong estimation |
Дата | |
Msg-id | 9157fdeb-f2fc-0b8f-4f78-0c4f964ff221@gmail.com обсуждение исходный текст |
Ответ на | [HACKERS] auto_explain : log queries with wrong estimation (Adrien Nayrat <adrien.nayrat@dalibo.com>) |
Ответы |
Re: [HACKERS] auto_explain : log queries with wrong estimation
|
Список | pgsql-hackers |
On 24.08.2017 14:56, Adrien Nayrat wrote:
Hi,
AFAICS you want to introduce two additional per-node variables:
- auto_explain_log_estimate_ratio that denotes minimum ratio (>= 1) between real value and planned one. I would add 'min' prefix before 'ratio'.
- auto_explain_log_estimate_min_rows - minimum absolute difference between those two values. IMHO this name is somewhat poor, the suffix 'min_diff_rows' looks better.
If real expressions (ratio and diff) exceed these threshold values both, you log this situation. I'm right?
Instrumentation is initialized only with analyze (log_analyze is true)[1]
It's interesting question. In one's time I didn't find any way to get the amount of tuples emitted from a node.
1. contrib/auto_explain/auto_explain.c:221
Hi hackers,
Hi,
I try to made a patch to auto_explain in order to log queries with wrong estimation.
I compare planned row id : queryDesc->planstate->plan->plan_rows
Vs ntuples : queryDesc->planstate->instrument->ntuples;
AFAICS you want to introduce two additional per-node variables:
- auto_explain_log_estimate_ratio that denotes minimum ratio (>= 1) between real value and planned one. I would add 'min' prefix before 'ratio'.
- auto_explain_log_estimate_min_rows - minimum absolute difference between those two values. IMHO this name is somewhat poor, the suffix 'min_diff_rows' looks better.
If real expressions (ratio and diff) exceed these threshold values both, you log this situation. I'm right?
If I understand, instrumentation is used only with explain. So my patch works
only with explain (and segfault without).
Instrumentation is initialized only with analyze (log_analyze is true)[1]
Is there a simple way to get ntuples?
It's interesting question. In one's time I didn't find any way to get the amount of tuples emitted from a node.
1. contrib/auto_explain/auto_explain.c:221
-- Regards, Maksim Milyutin
В списке pgsql-hackers по дате отправления: