Re: [SQL] Forcing query to use an index

2003-03-04 Thread Jean-Luc Lachance
I beg to differ. A NULL field means not set. Having to use work around because the database does not index null is one thing, but making it a general rule is not. Having NULL indexed would also speed up things when "is null" is part af the query. Until then... JLL Greg Stark wrote: > > One

Re: [SQL] Forcing query to use an index

2003-03-03 Thread Greg Stark
> -> Merge Join (cost=6106.42..6335.30 rows=2679 width=265) (actual time=859.77..948.06 rows=1 loops=1) Actually another problem, notice the big discrepancy between the estimated row and the actual rows. That's because you have the big OR clause so postgres figures there's

Re: [SQL] Forcing query to use an index

2003-03-03 Thread Greg Stark
One suggestion I'll make about your data model -- I'm not sure it would actually help this query, but might help elsewhere: WHERE ( C.Disabled > '2003-02-28' OR C.Disabled IS NULL ) Don't use NULL values like this. Most databases don't index NULLs (Oracle) or even if they do, don't

Re: [SQL] Forcing query to use an index

2003-03-03 Thread Michael Nachbaur
On Monday, Mar 3, 2003, at 15:32 US/Pacific, Josh Berkus wrote: Check out the thread: Re: [SQL] OUTER JOIN with filter in today's list; this relates to your problem. Then try your query as: I'll read through this, thank you. LEFT OUTER JOIN (SELECT * FROM Customer_Month_Summary WHRE CMS.Mon