auto_explain : log queries with wrong estimation

From: Adrien Nayrat <adrien(dot)nayrat(at)dalibo(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: auto_explain : log queries with wrong estimation
Date: 2017-08-24 11:56:20
Message-ID: 55d18a40-d99f-eccc-7323-62e0806ad7a6@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

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;

If I understand, instrumentation is used only with explain. So my patch works
only with explain (and segfault without).

Is there a simple way to get ntuples?

Attached a naive patch.

Thanks :)

--
Adrien NAYRAT

http://dalibo.com - http://dalibo.org

Attachment Content-Type Size
log_wrong_estimation_v1.path text/plain 3.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2017-08-24 12:08:08 Re: POC: Sharing record typmods between backends
Previous Message Thomas Munro 2017-08-24 11:08:52 MCXT_ALLOC_NO_OOM -> DSA_ALLOC_NO_OOM in dsa.c