Re: index fragmentation on insert-only table with non-unique column

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: index fragmentation on insert-only table with non-unique column
Date: 2016-06-03 21:26:33
Message-ID: CAGTBQpbqkQYRbnz-7MJEhCL9bRhaE3sX12LZh4YGh4m+xoUqYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, May 25, 2016 at 11:00 AM, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
>> > First, I found I was able to get 30-50min query results on full week's table by
>> > prefering a seq scan to an index scan. The row estimates seemed fine, and the
>> > only condition is the timestamp, so the planner's use of index scan is as
>> > expected.
>>
>> Can you show us the query? I would expect a bitmap scan of the index
>> (which would do what you want, but even more so), instead.
> See explain, also showing additional tables/views being joined. It's NOT doing
> a bitmap scan though, and I'd be interested to find why; I'm sure that would've
> improved this query enough so it never would've been an issue.
> https://explain.depesz.com/s/s8KP
>
> -> Index Scan using cdrs_huawei_pgwrecord_2016_05_01_recordopeningtime_idx on cdrs_huawei_pgwrecord_2016_05_01 (cost=0.56..1601734.57 rows=8943848 width=349)
> Index Cond: ((recordopeningtime >= '2016-05-07 00:00:00'::timestamp without time zone) AND (recordopeningtime < '2016-05-08 00:00:00'::timestamp without time zone))

Please show your guc settings ( see
https://wiki.postgresql.org/wiki/Server_Configuration )

A plan node like that, if it would result in I/O, with proper
configuration should have selected a bitmap index/heap scan. If it
didn't, it probably thinks it has more cache than it really does, and
that would mean the wrong setting was set in effective_cache_size.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message avi Singh 2016-06-03 23:03:18 slony rpm help slony1-95-2.2.2-1.rhel6.x86_64
Previous Message Антон Бушмелев 2016-06-02 11:18:26 Re: 9.4 -> 9.5 regression with queries through pgbouncer on RHEL 6