select query optimization

From: sergey <kapustin(dot)sergey(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: select query optimization
Date: 2006-08-04 18:55:59
Message-ID: 44D3983F.60503@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all!
i run this query

select f1,f2
from t1,t2
where
t1.url_id=t2.entry_id and
(t1.entry_stamp::date>=(now()::date-interval '14 days')) and
....

the problem is that t1 is a very big table so the query is too slow.
what if i move the second condition to where-clause. Can this reduce the
select time?

select f1,f2
from (select * from t1 where t1.entry_stamp::date>=(now()::date-interval
'14 days' ) as t1,t2
where
t1.url_id=t2.entry_id and
....

Does this makes sense?
(tried to make explain analyze, but it takes too much time)

Thank you.

Browse pgsql-sql by date

  From Date Subject
Next Message Melvin Davidson 2006-08-04 21:23:20 to_dec()
Previous Message Richard Huxton 2006-08-04 18:18:50 Re: autoupdating mtime column