Search Postgresql Archives

Re: INSERT/UPDATE statements sometimes choosing not to use PK index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt <bsg075@xxxxxxxxx> writes:
> In most cases, EXPLAIN and runtime tell me the index is utilized. However,
> sometime on back to back runs (5 minute intervals) the runtime explodes and
> EXPLAIN shows me that the PK index is not used, as both the staging table
> and destination table a sequentially scanned.

You haven't explained what you do with the "staging table", but maybe you
need to ANALYZE it after you've loaded fresh data into it.  The stats for
the main table are presumably somewhat stable, but the stats for the
staging table maybe not.  The apparent correlation to consecutive runs
lends some support to this theory, as that would reduce the time window
for auto-ANALYZE to fix it for you.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux