From: Tim Perdue <perdue@raccoon.com>
To: pgsql-sql@hub.org
Subject: Re: [SQL] Stuck on SQL - Any Takers?
Date: Thu, 18 Mar 1999 20:32:40 -0600
Message-ID: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net> (raw)
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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: perdue@raccoon.com, pgsql-sql@hub.org
Subject: Re: [SQL] Stuck on SQL - Any Takers?
In-Reply-To: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net>
References: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox