pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: o2@trustcommerce.com
Cc: pgsql-general@postgreSQL.org
Subject: Re: Index Scans Oddness
Date: Fri, 12 Oct 2001 15:47:55 -0400
Message-ID: <1188.1002916075@sss.pgh.pa.us> (raw)
In-Reply-To: <9q51rs$2o4b$1@news.tht.net>
References: <9q51rs$2o4b$1@news.tht.net>

Orion <o2@trustcommerce.com> writes:
>         select * from foo where text_field like 'foo%'
> will do an index scan with my data in 7.0.3 but not 7.1.3-1PGDG.
> Makes me think there's a bug.

Yes: in 7.0.  You're probably running in a non-C locale, wherein
optimizing LIKE with an indexscan is unsafe.

>         select * from foo where order_date = current_date
> and
>         select * from foo
>         where order_date < to_date(xxx) and order_date > to_date(yyy) 

> Both do sequence scans where current date is indexed

The problem is probably lack of cachability of current_date and to_date().
You can fix this with a wrapper function that's marked "iscachable".
Look in the mailing list archives for prior discussions.

			regards, tom lane



view thread (2+ messages)

Message-ID: <1188.1002916075@sss.pgh.pa.us>
Permalink:  ../1188.1002916075@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1188.1002916075@sss.pgh.pa.us

 · 

reply

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, o2@trustcommerce.com, pgsql-general@postgreSQL.org
  Subject: Re: Index Scans Oddness
  In-Reply-To: <1188.1002916075@sss.pgh.pa.us>
  References: <9q51rs$2o4b$1@news.tht.net> <1188.1002916075@sss.pgh.pa.us>

* 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