pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sergey <kapustin.sergey@gmail.com>
To: pgsql-sql@postgresql.org
Subject: select query optimization
Date: Fri, 04 Aug 2006 20:55:59 +0200
Message-ID: <44D3983F.60503@gmail.com> (raw)

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.



Message-ID: <44D3983F.60503@gmail.com>
Permalink:  ../44D3983F.60503@gmail.com/
Also on:    postgresql.org/message-id/44D3983F.60503@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kapustin.sergey@gmail.com
  Subject: Re: select query optimization
  In-Reply-To: <44D3983F.60503@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox