public inbox for [email protected]  
help / color / mirror / Atom feed
slow index scan performance
3+ messages / 1 participants
[nested] [flat]

* slow index scan performance
@ 2017-09-05 13:24 Soni M <[email protected]>
  2017-09-05 13:46 ` Re: slow index scan performance Soni M <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Soni M @ 2017-09-05 13:24 UTC (permalink / raw)
  To: pgsql-performance

Consider these 2 index scan produced by a query

->  Index Scan using response_log_by_activity on public.response_log rl2
 (cost=0.00..51.53 rows=21 width=8) (actual time=9.017..9.056 rows=0
loops=34098)
                                       Output: rl2.activity_id, rl2.feed_id
                                       Index Cond: (rl2.activity_id =
rl.activity_id)
                                       Filter: rl2.success
                                       Buffers: shared hit=3357159
read=153313
                           ->  Index Scan using activity_pkey on
public.activity a  (cost=0.00..51.10 rows=1 width=12) (actual
time=0.126..0.127 rows=1 loops=34088)
                                 Output: a.status_id, a.activity_id,
a.visit_id
                                 Index Cond: (a.activity_id =
rl.activity_id)
                                 Buffers: shared hit=137925 read=32728


And it's size

conscopy=# select
pg_size_pretty(pg_relation_size('response_log_by_activity'::regclass));
 pg_size_pretty
----------------
 7345 MB
(1 row)

conscopy=# select
pg_size_pretty(pg_relation_size('activity_pkey'::regclass));
 pg_size_pretty
----------------
 8110 MB
(1 row)

Index scan on response_log_by_activity is far slower. The table has just
been repacked, and index rebuilt, but still slow.

Is there any other way to make it faster ?

Why Buffers: shared hit=3,357,159 read=153,313 on response_log_by_activity
is much bigger than Buffers: shared hit=137925 read=32728 on activity_pkey
while activity_pkey size is bigger ?

-- 
Regards,

Soni Maula Harriz


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: slow index scan performance
  2017-09-05 13:24 slow index scan performance Soni M <[email protected]>
@ 2017-09-05 13:46 ` Soni M <[email protected]>
  2017-09-05 13:58   ` Re: slow index scan performance Soni M <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Soni M @ 2017-09-05 13:46 UTC (permalink / raw)
  To: pgsql-performance

It's Postgres 9.1.24 on RHEL 6.5

On Tue, Sep 5, 2017 at 8:24 PM, Soni M <[email protected]> wrote:

> Consider these 2 index scan produced by a query
>
> ->  Index Scan using response_log_by_activity on public.response_log rl2
>  (cost=0.00..51.53 rows=21 width=8) (actual time=9.017..9.056 rows=0
> loops=34098)
>                                        Output: rl2.activity_id, rl2.feed_id
>                                        Index Cond: (rl2.activity_id =
> rl.activity_id)
>                                        Filter: rl2.success
>                                        Buffers: shared hit=3357159
> read=153313
>                            ->  Index Scan using activity_pkey on
> public.activity a  (cost=0.00..51.10 rows=1 width=12) (actual
> time=0.126..0.127 rows=1 loops=34088)
>                                  Output: a.status_id, a.activity_id,
> a.visit_id
>                                  Index Cond: (a.activity_id =
> rl.activity_id)
>                                  Buffers: shared hit=137925 read=32728
>
>
> And it's size
>
> conscopy=# select pg_size_pretty(pg_relation_size('response_log_by_
> activity'::regclass));
>  pg_size_pretty
> ----------------
>  7345 MB
> (1 row)
>
> conscopy=# select pg_size_pretty(pg_relation_size('activity_pkey'::
> regclass));
>  pg_size_pretty
> ----------------
>  8110 MB
> (1 row)
>
> Index scan on response_log_by_activity is far slower. The table has just
> been repacked, and index rebuilt, but still slow.
>
> Is there any other way to make it faster ?
>
> Why Buffers: shared hit=3,357,159 read=153,313 on response_log_by_activity
> is much bigger than Buffers: shared hit=137925 read=32728 on activity_pkey
> while activity_pkey size is bigger ?
>
> --
> Regards,
>
> Soni Maula Harriz
>



-- 
Regards,

Soni Maula Harriz


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: slow index scan performance
  2017-09-05 13:24 slow index scan performance Soni M <[email protected]>
  2017-09-05 13:46 ` Re: slow index scan performance Soni M <[email protected]>
@ 2017-09-05 13:58   ` Soni M <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Soni M @ 2017-09-05 13:58 UTC (permalink / raw)
  To: pgsql-performance

Trying on another server, it gives different result.

->  Index Scan using response_log_by_activity on public.response_log rl2
 (cost=0.00..50.29 rows=17 width=8) (actual time=0.955..0.967 rows=0
loops=30895)
                                       Output: rl2.activity_id, rl2.feed_id
                                       Index Cond: (rl2.activity_id =
rl.activity_id)
                                       Filter: rl2.success
                                       Buffers: shared hit=2311312
read=132342
                           ->  Index Scan using activity_pkey on
public.activity a  (cost=0.00..49.79 rows=1 width=12) (actual
time=13.747..13.762 rows=1 loops=30892)
                                 Output: a.status_id, a.activity_id,
a.visit_id
                                 Index Cond: (a.activity_id =
rl.activity_id)
                                 Buffers: shared hit=124463 read=30175

Now, index scan on activity_pkey which take much slower. Can someone please
explain these ?

Thanks

On Tue, Sep 5, 2017 at 8:46 PM, Soni M <[email protected]> wrote:

> It's Postgres 9.1.24 on RHEL 6.5
>
> On Tue, Sep 5, 2017 at 8:24 PM, Soni M <[email protected]> wrote:
>
>> Consider these 2 index scan produced by a query
>>
>> ->  Index Scan using response_log_by_activity on public.response_log rl2
>>  (cost=0.00..51.53 rows=21 width=8) (actual time=9.017..9.056 rows=0
>> loops=34098)
>>                                        Output: rl2.activity_id,
>> rl2.feed_id
>>                                        Index Cond: (rl2.activity_id =
>> rl.activity_id)
>>                                        Filter: rl2.success
>>                                        Buffers: shared hit=3357159
>> read=153313
>>                            ->  Index Scan using activity_pkey on
>> public.activity a  (cost=0.00..51.10 rows=1 width=12) (actual
>> time=0.126..0.127 rows=1 loops=34088)
>>                                  Output: a.status_id, a.activity_id,
>> a.visit_id
>>                                  Index Cond: (a.activity_id =
>> rl.activity_id)
>>                                  Buffers: shared hit=137925 read=32728
>>
>>
>> And it's size
>>
>> conscopy=# select pg_size_pretty(pg_relation_siz
>> e('response_log_by_activity'::regclass));
>>  pg_size_pretty
>> ----------------
>>  7345 MB
>> (1 row)
>>
>> conscopy=# select pg_size_pretty(pg_relation_siz
>> e('activity_pkey'::regclass));
>>  pg_size_pretty
>> ----------------
>>  8110 MB
>> (1 row)
>>
>> Index scan on response_log_by_activity is far slower. The table has just
>> been repacked, and index rebuilt, but still slow.
>>
>> Is there any other way to make it faster ?
>>
>> Why Buffers: shared hit=3,357,159 read=153,313 on
>> response_log_by_activity is much bigger than Buffers: shared hit=137925
>> read=32728 on activity_pkey while activity_pkey size is bigger ?
>>
>> --
>> Regards,
>>
>> Soni Maula Harriz
>>
>
>
>
> --
> Regards,
>
> Soni Maula Harriz
>



-- 
Regards,

Soni Maula Harriz


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-09-05 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05 13:24 slow index scan performance Soni M <[email protected]>
2017-09-05 13:46 ` Soni M <[email protected]>
2017-09-05 13:58   ` Soni M <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox