Re: SELECT slow immediately after many update or delete+insert, except using WHERE .. IN

From: Tom DalPozzo <t(dot)dalpozzo(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT slow immediately after many update or delete+insert, except using WHERE .. IN
Date: 2016-12-10 17:08:55
Message-ID: CAK77FCT6CR25VhMqggZCyQ0EGht5GHVr-bKfCP01yPa4vPzn_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-12-10 15:41 GMT+01:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:

> On 12/10/2016 04:21 AM, Tom DalPozzo wrote:
>
>> Hi,
>> my release is 9.5.4.
>> a took a look over it. I guessed that counting could be slow because it
>> needs to read everything and also that it can take advantage from an
>> index. But I don't understand why the delay is after the updates for a
>>
>
> Best guess, autovacuum kicked in and marked a bunch of rows as no longer
> in play and thereby reduced the number of rows that needed to be counted.
>
> certain time and why WHERE..IN is much faster (ok, it's an index, but
>> I'm reading all the rows).
>>
>
> So per the second link have you tried something like:
>
> SELECT COUNT(*) FROM Table WHERE id > 0;
>
>
>> ​Hi,
no I ​

​did not (yet). But I guess that it would be similar to the one or to the
other. I will give updates if I try.
Regards
Pupillo

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2016-12-10 17:10:15 Re: huge table occupation after updates
Previous Message Tom DalPozzo 2016-12-10 17:01:34 Re: huge table occupation after updates