From: Tom Lane <tgl@sss.pgh.pa.us>
To: Roger Ging <rging@paccomsys.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow query
Date: Fri, 22 Oct 2004 16:37:14 -0400
Message-ID: <18707.1098477434@sss.pgh.pa.us> (raw)
In-Reply-To: <41795A35.4060802@paccomsys.com>
References: <41795A35.4060802@paccomsys.com>
Roger Ging <rging@paccomsys.com> writes:
> update source_song_title set
> source_song_title_id = nextval('source_song_title_seq')
> ,licensing_match_order = (select licensing_match_order from
> source_system where source_system_id = ss.source_system_id)
> ,affiliation_match_order = (select affiliation_match_order from
> source_system where source_system_id = ss.source_system_id)
> ,title = st.title
> from source_song_title sst
> join source_song ss on ss.source_song_id = sst.source_song_id
> join source_title st on st.title_id = sst.title_id
> where source_song_title.source_song_id = sst.source_song_id;
Why is "source_song_title sst" in there? To the extent that
source_song_id is not unique, you are multiply updating rows
because of the self-join.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, rging@paccomsys.com
Subject: Re: Slow query
In-Reply-To: <18707.1098477434@sss.pgh.pa.us>
* 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