On Thu, May 8, 2014 at 12:01 PM, Jaime Casanova <jaime@2ndquadrant.com> wrote:
> On Wed, May 7, 2014 at 10:52 PM, Amit Kapila <amit.kapila16@gmail.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 msExecution
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