X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7F014474E42 for ; Tue, 6 May 2003 10:39:55 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id E8DE84764DA for ; Tue, 6 May 2003 10:39:53 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 15445D63D; Tue, 6 May 2003 07:39:58 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 0ACCA5C0C; Tue, 6 May 2003 07:39:58 -0700 (PDT) Date: Tue, 6 May 2003 07:39:57 -0700 (PDT) From: Stephan Szabo To: "Fabio C. Bon" Cc: Subject: Re: [ADMIN] A query with performance problems. In-Reply-To: <003301c313c9$fe7a2d80$0501a8c0@kdomain> Message-ID: <20030506073613.K7678-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/67 X-Sequence-Number: 1846 [Moving to -performance since it's more ontopic there] On Tue, 6 May 2003, Fabio C. Bon wrote: > I have a database on PostgreSQL 7.2.1 and I have performance's problems with > some queries. > I'm debbuging the query below: > > Select count(*) from blcar > where manide = 3811 and blide = 58090 and bcalupcod = 'MVDUY' and bcalopcod > = 'LOCAL' and bcapag <> 'P'; What does the schema of the table look like? Is the SQL query in the file exactly the same text as the above? > Aggregate (cost=8277.10..8277.10 rows=1 width=0) (actual > time=1273.98..1273.98 rows=1 loops=1) > -> Seq Scan on blcar (cost=0.00..8277.09 rows=1 width=0) (actual > time=1273.96..1273.96 rows=0 loops=1) > Filter: (((manide)::numeric = 3811::numeric) AND ((blide)::numeric It seems to want to coerce manide and blide to a numeric here, which seems odd. > = 58090::numeric) AND (bcalupcod = 'MVDUY'::bpchar) AND (bcalopcod = > 'REPRE'::bpchar) AND (bcapag <> 'P'::bpchar)) > Total runtime: 1274.08 msec > (4 rows)