X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 730B6475B85 for ; Sat, 19 Apr 2003 09:01:43 -0400 (EDT) Received: from filer (12-234-86-219.client.attbi.com [12.234.86.219]) by postgresql.org (Postfix) with ESMTP id A7F6A4758C9 for ; Sat, 19 Apr 2003 09:01:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Sat, 19 Apr 2003 06:01:46 -0700 Date: Sat, 19 Apr 2003 06:01:46 -0700 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: [SQL] Yet Another (Simple) Case of Index not used Message-ID: <20030419130146.GI1847@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <200304090918.45275.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <200304090918.45275.josh@agliodbs.com> User-Agent: Mutt/1.4i Organization: Frobozzco International X-Spam-Status: No, hits=-38.0 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/170 X-Sequence-Number: 1676 Josh Berkus wrote: > Denis, > > > Are you saying the 7.4 'group by' trick would be faster than the simple > > select count(*)? That seems hard to believe, being that the request now has > > to fetch / sort the data. I must be missing something. > > No, I'm saying that the 7.4 hash-aggregate is faster than the same query was > under 7.2 or 7.3. Much faster. But it does little to speed up a raw > count(*). > > > The kind of requests that I am really interested in are: > > select count(*) from table where table.column like 'pattern%' > > > These seems to go much master on mysql (which I guess it not a MVCC > > database? or wasn't the Innobase supposed to make it so?), > > 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 (the performance losses you saw may well have been the result of PG's somewhat poor trigger performance, and not the result of the approach itself. It would be interesting to know how triggers effect the performance of other databases). -- Kevin Brown kevin@sysexperts.com