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@sitening.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