From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Brown <kevin@sysexperts.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: [SQL] Yet Another (Simple) Case of Index not used
Date: Sat, 19 Apr 2003 11:58:48 -0400
Message-ID: <21955.1050767928@sss.pgh.pa.us> (raw)
In-Reply-To: <20030419130146.GI1847@filer>
References: <EKEBJNAJDPKJBDFGJNIJAENMDBAA.denis@next2me.com>
<200304090918.45275.josh@agliodbs.com>
<20030419130146.GI1847@filer>
Kevin Brown <kevin@sysexperts.com> writes:
> Josh Berkus wrote:
>> They did incorporate a lot of MVCC logic into InnoDB tables, yes.
>> Which means that if SELECT count(*) on an InnoDB table is just as
>> fast as a MyISAM table, then it is not accurate.
> This is not necessarily true. The trigger-based approach to tracking
> the current number of rows in a table might well be implemented
> internally, and that may actually be much faster than doing it using
> triggers
You missed the point of Josh's comment: in an MVCC system, the correct
COUNT() varies depending on which transaction is asking. Therefore it
is not possible for a centrally maintained row counter to give accurate
results to everybody, no matter how cheap it is to maintain.
(The cheapness can be disputed as well, since it creates a single point
of contention for all inserts and deletes on the table. But that's a
different topic.)
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, kevin@sysexperts.com, pgsql-performance@postgresql.org
Subject: Re: [SQL] Yet Another (Simple) Case of Index not used
In-Reply-To: <21955.1050767928@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox