X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 66B6F4758F1 for ; Tue, 8 Apr 2003 20:12:26 -0400 (EDT) Received: from localhost.localdomain (adsl-216-103-208-155.dsl.snfc21.pacbell.net [216.103.208.155]) by postgresql.org (Postfix) with ESMTP id 0DB50474E42 for ; Tue, 8 Apr 2003 20:12:12 -0400 (EDT) Received: from flipper5 (flipper5.next2me.com [192.168.0.3]) by localhost.localdomain (8.12.8/8.12.8) with SMTP id h390DYgL032299; Tue, 8 Apr 2003 17:13:34 -0700 Reply-To: From: "Denis @ Next2Me" To: "Martijn van Oosterhout" , "Denis" Cc: Subject: Re: [GENERAL] Yet Another (Simple) Case of Index not used Date: Tue, 8 Apr 2003 17:10:01 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <20030408234623.GD15928@svana.org> X-Spam-Status: No, hits=-14.7 required=5.0 tests=BAYES_10,IN_REP_TO,MSGID_GOOD_EXCHANGE 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/78 X-Sequence-Number: 1584 Interesting generic response. In other words, "it all depends". Well, a de facto observation is: "In my case, it's always much slower with, say, mysql". Understand me, I don't mean to be starting a performance comparaison mysql vs postgresql, which is probably an old subject, I am just looking for a solution to solve this type of performance issues, ie the generic cases: select count(*) from addresses where address is like 'pattern%'; Which are very fast on mysql, and very slow on postgresql. Understood, it will always depend on some parameters, but the real question is: how much control does one have over those parameters, and how does one tweak them to reach optimal performance? D. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Martijn van > Oosterhout > Sent: Tuesday, April 08, 2003 4:46 PM > To: Denis > Cc: pgsql-performance@postgresql.org; pgsql-general@postgresql.org; > pgsql-sql@postgresql.org > Subject: Re: [PERFORM] [GENERAL] Yet Another (Simple) Case of Index not > used > > > On Tue, Apr 08, 2003 at 12:57:16PM -0700, Denis wrote: > > The query I am trying to do (fast) is: > > > > select count(*) from addresses; > > > > This takes more than a second to complete, because, as the 'explain' command > > shows me, > > the index created on 'addresses' is not used, and a seq scan is being used. > > One would assume that the creation of an index would allow the counting of > > the number of entries in a table to be instantanous? > > Incorrect assumption. select count(*) can produce different results in > different backends depending on the current state of the active > transactions. > -- > Martijn van Oosterhout http://svana.org/kleptog/ > > "the West won the world not by the superiority of its ideas or values or > > religion but rather by its superiority in applying organized violence. > > Westerners often forget this fact, non-Westerners never do." > > - Samuel P. Huntington >