Received: from mail.computalog.com ([209.82.103.230]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4UNPtE25606 for ; Wed, 30 May 2001 19:25:55 -0400 (EDT) (envelope-from linh.luong@computalog.com) Received: from jamie.edmonton.computalog.com (mugeri.computalog.com [209.82.103.229]) by mail.computalog.com (8.8.8/8.8.8) with ESMTP id RAA30242 for ; Wed, 30 May 2001 17:26:10 -0600 Received: from computalog.com (localhost [127.0.0.1]) by jamie.edmonton.computalog.com (Postfix) with ESMTP id 3C7C7197399 for ; Wed, 30 May 2001 17:33:15 -0600 (MDT) Message-ID: <3B15833A.393513A8@computalog.com> Date: Wed, 30 May 2001 17:33:14 -0600 From: Linh Luong X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-pentiumiii-smp i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Too many rows returning Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/351 X-Sequence-Number: 3192 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 T2 on 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 T2 on T1.field1=T2.field2 UNION select ..,..,,...,. from (subselect. ... ) as T1 LEFT JOIN (subselect ... ) as T2 on 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