Re: Select retrieval slowdown after db drop/reload. Suggestions?

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Andrew Edson <cheighlund(at)yahoo(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select retrieval slowdown after db drop/reload. Suggestions?
Date: 2007-02-28 22:23:00
Message-ID: 1172701380.20651.159.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2007-02-28 at 13:55, Andrew Edson wrote:
> I have a select statement, used in a Perl program, which is supposed
> to find all records related to those in one table which have a
> delete_dt field value of four years or older.
>
> This is the select statement:
> SELECT t2.dist_id, t1.clnt_seq, t2.cntrct_seq, t2.cntrct_id,
> t3.aunit_seq, t1.person_seq, t1.addr_seq, t3.addr_seq, t4.frst_nm || '
> ' || t4.lst_nm AS name, t5.addr_1, t6.acntdel_dt FROM t1, t2, t3, t4,
> t5, t6 WHERE t1.clnt_seq = t2.clnt_seq AND t2.cntrct_seq =
> t3.cntrct_seq AND t3.aunit_seq = t6.aunit_seq AND t1.person_seq =
> t4.person_seq AND t3.addr_seq = t5.addr_seq AND t1.active_flg =0 AND
> t2.active_flg =0 AND t3.active_flg = 0 AND t6.acntdel_dt < now() - '4
> years'::interval order by t2.cntrct_id asc;

What version of pgsql are you running?

Is acntdel_dt indexed?

What does explain (and maybe explain analyze) for this query say?

What does it say on your other boxes?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2007-02-28 22:35:20 Re: How often do I need to reindex tables?
Previous Message Brandon Aiken 2007-02-28 22:17:02 Re: Difference between UNIQUE constraint vs index