OUTER JOIN IS SLOW - Mailing list pgsql-admin

From Benjamin Arai
Subject OUTER JOIN IS SLOW
Date
Msg-id 458D8D56.6020506@araisoft.com
Whole thread Raw
Responses Re: OUTER JOIN IS SLOW  ("Shoaib Mir" <shoaibmir@gmail.com>)
List pgsql-admin
I have been running pieces of my PL function by hand and I have found
that the following queries work by themselves taking less than a second
to execute.

getDateRange"('12/1/2005','12/1/2006')  <- simply generates a date
list.  Doesn't even access a table

SELECT * FROM mutualfd_weekday_qbid WHERE cusip='92193920' AND  pkey >=
'12/15/2005' AND pkey <= '12/15/2006';

But when combined as below it takes 10 seconds to execute.

SELECT d1 as date, d2.data as data FROM
"getDateRange"('12/1/2005','12/1/2006') d1 FULL OUTER JOIN (SELECT *
FROM mutualfd_weekday_qbid WHERE cusip='92193920' AND  pkey >=
'12/15/2005' AND pkey <= '12/15/2006') d2 ON d1=d2.pkey;

Do I need to increase the work_mem or is this possible still a ANALYZE
issue?

Benjamin

pgsql-admin by date:

Previous
From: Jeff Frost
Date:
Subject: Re: Problem with large table not using indexes (I think)
Next
From: "Shoaib Mir"
Date:
Subject: Re: OUTER JOIN IS SLOW