Re: [HACKERS] date index problems

2003-03-20 Thread Tom Lane
Gavin Sherry <[EMAIL PROTECTED]> writes: > I presume the type of plan_next is 'date'. Does casting '2003-01-01'::date > - interval '1 week' to date help? Easier would be '2003-01-01'::date - 7 which yields a date to start with. But yeah, date minus interval yields a timestamp, which will

Re: [HACKERS] date index problems

2003-03-20 Thread Gavin Sherry
On Fri, 21 Mar 2003, Christopher Kings-Lynne wrote: > This behaviour I find unusual: > > usa=# explain analyze select user_id, plan_next from users_profiles where > plan_next = '2003-01-01'; > QUERY PLAN > -

Re: [HACKERS] date index problems

2003-03-20 Thread Christopher Kings-Lynne
> Surely the planner is aware that '2003-01-01'::date - interval '1 week' is a > constant??? Actually, turns out that the planner was smarter than me I think. 2003-01-01 occurs very rarely in the system, but other dates occupy 1/7th of the table, so it's not so easy to plan... Chris ---

[HACKERS] date index problems

2003-03-20 Thread Christopher Kings-Lynne
This behaviour I find unusual: usa=# explain analyze select user_id, plan_next from users_profiles where plan_next = '2003-01-01'; QUERY PLAN -