Received: from slip1.raccoon.com (slip1.raccoon.com [165.90.135.16]) by hub.org (8.9.2/8.9.1) with ESMTP id VAA06264 for ; Thu, 18 Mar 1999 21:34:02 -0500 (EST) (envelope-from perdue@raccoon.com) Received: from timnt (tim.desmoinesnet.com [165.90.140.11]) by slip1.raccoon.com (8.8.7/8.8.7) with SMTP id UAA09708 for ; Thu, 18 Mar 1999 20:33:28 -0600 Message-ID: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net> Reply-To: "Tim Perdue" From: "Tim Perdue" To: Subject: Re: [SQL] Stuck on SQL - Any Takers? Date: Thu, 18 Mar 1999 20:32:40 -0600 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 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 I played with the query a little bit. In a nutshell, the performance is nothing short of horrible. 27:01 CPU time and no results - not even one record inserted into the new table. The same query completes in 5 seconds on MS Access. There must be a way to optimize my query so it runs in some sensible way on postgres?? Tim insert into tbl_ranked_teams2 SELECT tbl_teams.fld_team_no, tbl_athlete_stats_1.fld_total_points_ytd+ tbl_athlete_stats_2.fld_total_points_ytd+ tbl_athlete_stats_3.fld_total_points_ytd+ tbl_athlete_stats_4.fld_total_points_ytd+ tbl_athlete_stats_5.fld_total_points_ytd+ tbl_athlete_stats_6.fld_total_points_ytd+ tbl_athlete_stats_7.fld_total_points_ytd+ tbl_athlete_stats_8.fld_total_points_ytd+ tbl_athlete_stats_9.fld_total_points_ytd FROM tbl_athlete_stats tbl_athlete_stats_1, tbl_athlete_stats tbl_athlete_stats_2, tbl_athlete_stats tbl_athlete_stats_3, tbl_athlete_stats tbl_athlete_stats_4, tbl_athlete_stats tbl_athlete_stats_5, tbl_athlete_stats tbl_athlete_stats_6, tbl_athlete_stats tbl_athlete_stats_7, tbl_athlete_stats tbl_athlete_stats_8, tbl_athlete_stats tbl_athlete_stats_9 WHERE tbl_athlete_stats_1.fld_player_number = tbl_teams.fld_athlete1 and tbl_athlete_stats_2.fld_player_number = tbl_teams.fld_athlete2 and tbl_athlete_stats_3.fld_player_number = tbl_teams.fld_athlete3 and tbl_athlete_stats_4.fld_player_number = tbl_teams.fld_athlete4 and tbl_athlete_stats_5.fld_player_number = tbl_teams.fld_athlete5 and tbl_athlete_stats_6.fld_player_number = tbl_teams.fld_athlete6 and tbl_athlete_stats_7.fld_player_number = tbl_teams.fld_athlete7 and tbl_athlete_stats_8.fld_player_number = tbl_teams.fld_athlete8 and tbl_athlete_stats_9.fld_player_number = tbl_teams.fld_athlete9;