Skip site navigation (1) Skip section navigation (2)

Re: How do I convice postgres to use an index?

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: SZUCS Gábor <surrano(at)mailbox(dot)hu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How do I convice postgres to use an index?
Date: 2004-07-15 14:00:36
Message-ID: Pine.LNX.4.44.0407151659420.12214-100000@matrix.gatewaynet.com (view raw or flat)
Thread:
Lists: pgsql-sql
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(at)ricker(dot)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


In response to

Responses

pgsql-sql by date

Next:From: SZUCS GáborDate: 2004-07-15 14:29:17
Subject: Re: How do I convice postgres to use an index?
Previous:From: Christopher BrowneDate: 2004-07-15 02:44:52
Subject: Re: Secure DB Systems - How to

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group