Re: [SQL] Yet Another (Simple) Case of Index not used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [SQL] Yet Another (Simple) Case of Index not used
Date: 2003-04-20 15:25:29
Message-ID: 27004.1050852329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance pgsql-sql

Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de> writes:
> I think a row counter on each table would be even useful for some kind
> of auto-vacuum mechanism, that could be triggered if pg_class.reltuples
> deviates too far from the real row count.

It would be counting the wrong thing. auto-vacuum needs to know how
many dead tuples are in a table, not how many live ones. Example:
UPDATE doesn't change the live-tuple count (without this property,
I don't think the sort of count maintenance Kevin is proposing could
possibly be efficient enough to be interesting). But it does create
a dead tuple that vacuum wants to know about.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Pflug 2003-04-20 15:37:57 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Tom Lane 2003-04-20 15:21:32 Re: [SQL] Yet Another (Simple) Case of Index not used

Browse pgsql-performance by date

  From Date Subject
Next Message Andreas Pflug 2003-04-20 15:37:57 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Tom Lane 2003-04-20 15:21:32 Re: [SQL] Yet Another (Simple) Case of Index not used

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Pflug 2003-04-20 15:37:57 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Tom Lane 2003-04-20 15:21:32 Re: [SQL] Yet Another (Simple) Case of Index not used