From: | Samuel Williams <space(dot)ship(dot)traveller(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Large data and slow queries |
Date: | 2017-04-19 15:13:24 |
Message-ID: | CAHkN8V9xgEvhppOB1PhRZ8AotSxFj=0jMUsHBXx+OM7uhJ=7PA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ah right, yeah, it's insert only. So, it's never been vacuumed.
On 20 April 2017 at 01:25, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> Greetings,
>
> * Samuel Williams (space(dot)ship(dot)traveller(at)gmail(dot)com) wrote:
>> Thanks for all the suggestions Stephen.
>>
>> > That explain analyze shows a whole ton of heap fetches. When was the
>> last time a VACUUM was run on this table, to build the visibility map?
>> Without the visibility map being current, an Index-Only Scan, as is
>> happening here, can really suck.
>>
>> I'm using the default 9.6 config, I thought that auto-vacuum was on by default?
>
> Sure, but that doesn't mean the table gets vacuumed. In particular,
> actual vacuums are only kicked off when the number of *updated* or
> *deleted* tuples passes the autovacuum threshold. If no updates or
> deletes are done on the table (iow, it's essentially an insert-only or
> insert-mostly table), the autovacuum daemon nevers runs a vacuum on it
> (though it'll run analyze's).
>
> https://www.postgresql.org/docs/current/static/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-THRESHOLD
>
> Check pg_stat_all_tables to see when/if the table has actually been
> vacuumed.
>
> Thanks!
>
> Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2017-04-19 15:20:27 | Re: Large data and slow queries |
Previous Message | Tom Lane | 2017-04-19 14:37:50 | Re: tuple statistics update |