Re: How do I convice postgres to use an index?
От | SZUCS Gábor |
---|---|
Тема | Re: How do I convice postgres to use an index? |
Дата | |
Msg-id | 00d701c46a78$1d675eb0$0403a8c0@fejleszt4 обсуждение исходный текст |
Ответ на | How do I convice postgres to use an index? (Vic Ricker <vic@ricker.us>) |
Ответы |
Re: How do I convice postgres to use an index?
|
Список | pgsql-sql |
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 :) "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.
В списке pgsql-sql по дате отправления: