X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36CE5D1B16A for ; Thu, 15 Jul 2004 11:50:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02328-06 for ; Thu, 15 Jul 2004 14:50:48 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 504E0D1B1CE for ; Thu, 15 Jul 2004 11:50:37 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id i6FE0aQr012262; Thu, 15 Jul 2004 17:00:36 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id i6FE0aWv012258; Thu, 15 Jul 2004 17:00:36 +0300 Date: Thu, 15 Jul 2004 17:00:36 +0300 (EEST) From: Achilleus Mantzios To: =?iso-8859-1?Q?SZUCS_G=E1bor?= Cc: pgsql-sql@postgresql.org Subject: Re: How do I convice postgres to use an index? In-Reply-To: <00d701c46a78$1d675eb0$0403a8c0@fejleszt4> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/93 X-Sequence-Number: 18345 O kyrios SZUCS Gábor egrapse stis Jul 15, 2004 : > Try casting the constant to the type of the field, i.e. > > WHERE timestamp >= '7/12/2004'::"timestamp without time zone" > > (iirc the quotes are necessary) > > Also, I'd try to avoid naming attributes like (built-in) types. (iirc > "timestamp" is a type without time zone in 7.3, and with time zone in 7.4 :) ^^^^^^^^^^^^^^^^^^^^^^ Are you sure about it?? > "timestamptz" is the opposite in both cases) > > G. > %----------------------- cut here -----------------------% > \end > > ----- Original Message ----- > From: "Vic Ricker" > Sent: Tuesday, July 13, 2004 10:29 PM > > > > I apologize for the following stupid question. I have been doing some > > searching and haven't found anything really helpful. > > > > The problem is that postgres (7.4.2) keeps choosing to do a sequential > > scan on a table when an index scan would be significantly faster. > > > > The queries that I'm using look at daily statistics from events logged > > by our Checkpoint firewall and generate graphs. Since they are bit > > complicated, I simplified it to "select count(*) from log where > > timestamp>='7/12/2004'" for testing. > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- -Achilleus