Re: [WIP] showing index maintenance on EXPLAIN

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] showing index maintenance on EXPLAIN
Date: 2014-05-09 03:44:19
Message-ID: CAA4eK1K8vHrPo6WuNktGeTmCX_Aq47yVdxRfv1Y-VThodpJ+2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 8, 2014 at 12:01 PM, Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> On Wed, May 7, 2014 at 10:52 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> Why to capture only for Index Insert/Update and not for Read; is it
>> because Read will be always fast ot implementation complexity?
>>
>
> EXPLAIN ANALYZE already shows that on any SELECT that uses an index in
> some way. Or are you thinking on something else?

postgres=# explain analyze select * from t1 where c1 > 50000 and c1 <60000;
QUERY PLAN

--------------------------------------------------------------------------------
----------------------------------------
Index Scan using idx1_t1 on t1 (cost=0.29..983.57 rows=10014 width=508) (actua
l time=0.033..11.826 rows=9999 loops=1)
Index Cond: ((c1 > 50000) AND (c1 < 60000))
Planning time: 2.001 ms
Execution time: 18.486 ms
(4 rows)

Are you referring actual time in above print?

The actual time is node execution time which in above kind of cases will
be: scanning the index + scanning the heap. I think it is not same what
you are planning to show for Insert/Update case.

>> Why not similar timings for heap?
>>
>
> well "actual time" shows us total time of the operation so just
> deducting the time spent on triggers, indexes and planning seems like
> a way to get "heap modification time".

planning time doesn't include parse time, so above calculation might
not give time spent in heap during statement execution.

>> Why can't we print when only Analyze is used with Explain, the
>> execution time is printed with Analyze option?
>
> i'm not sure the info is useful for everyone, i'm not opposed to show
> it all the time though

Okay, no problem. I think it can be done based on what most people
expect.

>> Could you please tell in what all kind of scenario's, do you expect it
>> to be useful?
>> One I could think is that if there are multiple indexes on a table and user
>> wants to find out if any particular index is consuming more time.
>>
>
> exactly my use case. consider this plan (we spent 78% of the time
> updating the index uniq_idx_on_text):

I think this will be useful for such cases.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G Johnston 2014-05-09 04:04:44 Re: [WIP] showing index maintenance on EXPLAIN
Previous Message Bruce Momjian 2014-05-09 03:34:05 Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation)