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

Re: Index Analysis: Filters

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PgSQL - General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index Analysis: Filters
Date: 2004-09-30 02:29:51
Message-ID: 9B328500-1288-11D9-8537-000D93AE0944@sitening.com (view raw or flat)
Thread:
Lists: pgsql-general
Yeah, I suppose this would be faster than the EXTRACT technique, too, 
eh? Because it requires only a single index and is not an index on an 
expression, which are generally more expensive?

-tfo

On Sep 29, 2004, at 6:59 PM, Tom Lane wrote:

> "Thomas F.O'Connell" <tfo(at)sitening(dot)com> writes:
>> Here's what I've got:
>> WHERE some_date LIKE '<year>-<month>%' *
>
> Seems like you'd be better off turning this into a range query.  A
> textual LIKE is just about the most inefficient way of testing a date
> range that I can think of.  How about
>
> WHERE some_date >= 'year-month-01'::date AND some_date <
> ('year-month-01'::date + '1 month'::interval)::date
>
> (adjust as appropriate if it's really a timestamp column).
>
> 			regards, tom lane


In response to

pgsql-general by date

Next:From: Ed L.Date: 2004-09-30 02:33:18
Subject: Re: 7.3.4 vacuum/analyze error
Previous:From: Michael MalleteDate: 2004-09-30 02:12:39
Subject: Fwd: error: unicode characters greater than or equal to 0x10000

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