From: twm139@its.to
To: Tim Perdue <perdue@raccoon.com>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] Stuck on SQL - Any Takers?
Date: Thu, 18 Mar 1999 20:16:04 -0700 (MST)
Message-ID: <XFMail.990318201604.twm139@its.to> (raw)
In-Reply-To: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net>
Could you give me some more information. What does your data model look like?
The table you describe below looks like it could be seperated into two tables.
Also is the select going into a permanent table that will be maintained
seperately or is it more transient, a view may also be suitable.
Terrence
On 19-Mar-99 Tim Perdue wrote:
> 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;
>
----------------------------------
E-Mail: twm139@its.to
Date: 18-Mar-99
Time: 19:59:20
Lottery: A tax on people who are bad at math.
----------------------------------
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: twm139@its.to, perdue@raccoon.com, pgsql-sql@hub.org
Subject: Re: [SQL] Stuck on SQL - Any Takers?
In-Reply-To: <XFMail.990318201604.twm139@its.to>
References: <012e01be71b0$c2e20e10$0b8c5aa5@timnt.weather.net> <XFMail.990318201604.twm139@its.to>
* 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