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.
----------------------------------