Re: Poor performance on a right join

From: dev(at)archonet(dot)com
To: sarloc(at)jevic(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Poor performance on a right join
Date: 2003-03-14 08:13:18
Message-ID: 49213.192.168.1.32.1047629598.squirrel@mainbox.archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> When doing a join query I am getting a responce time of 3 seconds. The
> callhist table has 66000 rows and the phone table has 10000 rows. I
> have an indexes on callhist.call_date, callhist.operator_id,
> phone.phone, & phone.cust_code. Here's the SQL
> SELECT a.CALL_DATE, a.OPERATOR_ID, a.CUST_CODE FROM PHONE as b right
> join CALLHIST as a on (a.CUST_CODE=b.CUST_CODE) where (b.PHONE =
> '555-555-5555') order by a.call_date desc;
> The postgres db is running on a 2 P3 700 processor server with 1GB of
> ram running Red Hat Linux 7.3. I am running PostgreSQL 7.2.2
>
> Why is the query taking so long? What can I do to help the
> performance?

We'll need the output of EXPLAIN ANALYSE SELECT ...
Perhaps table definitions too.

- Richard Huxton

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Witham 2003-03-14 09:18:42 parse error when calling function in plpgsql
Previous Message Tomasz Myrta 2003-03-14 07:56:31 Re: displaying correct name