From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: SZUCS Gábor <surrano@mailbox.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: How do I convice postgres to use an index?
Date: Thu, 15 Jul 2004 17:00:36 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0407151659420.12214-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <00d701c46a78$1d675eb0$0403a8c0@fejleszt4>
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" <vic@ricker.us>
> 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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: achill@matrix.gatewaynet.com, surrano@mailbox.hu
Subject: Re: How do I convice postgres to use an index?
In-Reply-To: <Pine.LNX.4.44.0407151659420.12214-100000@matrix.gatewaynet.com>
References: <00d701c46a78$1d675eb0$0403a8c0@fejleszt4> <Pine.LNX.4.44.0407151659420.12214-100000@matrix.gatewaynet.com>
* 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