Received: from redbox.venux.net (redbox.venux.net [216.47.238.10]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA15565 for ; Fri, 17 Dec 1999 13:49:37 -0500 (EST) (envelope-from mitch@venux.net) Received: from doot2 (dyn1-tnt2-74.kalamazoo.mi.ameritech.net [206.141.249.74]) by redbox.venux.net (Postfix) with SMTP id 67FB92E227 for ; Fri, 17 Dec 1999 13:44:01 -0500 (EST) Message-ID: <018301bf48bf$8a068620$0300000a@doot.org> From: "Mitch Vincent" To: References: <17438.945241027@sss.pgh.pa.us> Subject: Sub-select speed. Date: Fri, 17 Dec 1999 13:50:06 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Hey guys, I have a few queries here that I would greatly appreciate any pointers on. I ned to get them as fast as possible but would settle for ANY speed improvement over what it is now.. select * from applicants as a where a.status = 'A' and a.app_id in(select b.app_id from resume_search as b where a.app_id=b.app_id and b.user_id=291) resume_search is a table populated by a query before this one. The schema is as follows : | user_id | int4 | 4 | | app_id | int4 | 4 | Indices: resume_app_id resume_search_id So, in it's current form, with only a few (say 5) rows in resume_search, it's still tking quite some time. In addition to this, I have another query liek this one, only it inserts to another table also.. insert into users_download_app (user_id,app_id) select app_id from applicants where status = 'A' and app_id in(select b.app_id from resume_search as b where app_id=b.app_id and b.user_id=291) limit 200 This one is so slow that it's unusable. (We're talking minutes here on my Celeron 333 devel server). I wish there was another way to get what I need to get done but the sub-selects are the only way I can see doing it now. I have a feeling though that there are some extra things that I might be able to do to get the same results from the same tables, faster. Thanks to one and all. -Mitch