Too many rows returning - Mailing list pgsql-sql

From Linh Luong
Subject Too many rows returning
Date
Msg-id 3B15833A.393513A8@computalog.com
Whole thread Raw
List pgsql-sql
Hi,

Does the number of rows affect how long it takes to execute a query.

I have 3 UNIONS.
One table has 97 rows, another has 7375 rows, and 1558;
In each union there are at least one LEFT OUTER JOIN and each subselect
has at least 2 JOINed tables.

Something like this:select ..,..,,...,.from (subselect. ...  ) as T1 LEFT JOIN(subselect ... ) as T2on
T1.field1=T2.field2
UNION
select ..,..,,...,.from ((subselect. ...) as T1 LEFT JOIN(subselect ....) as T2 on T1.field1=T2.field1) as T3 LEFT
JOIN(subselect... ) as T2on T1.field1=T2.field2
 
UNION
select ..,..,,...,.from (subselect. ...  ) as T1 LEFT JOIN(subselect ... ) as T2on T1.field1=T2.field2


When I do my sql stmt it takes more than 10minutes to return and
sometimes it display the maximum 30 sec has exceed...

Can anyone provide any suggestion in how I can speed up the execution
and possibly return something to me without the error message.

I have tried index but it doesn't seem to have an affect.. because I did
the explain it still using seq scan.. (re: last post "using indexes")

Thanks again


Linh


pgsql-sql by date:

Previous
From: Chris Ruprecht
Date:
Subject: Re: Unique record Identifier?
Next
From: "Koen Antonissen"
Date:
Subject: RE: primary key scans in sequence