Re: Slow query
| От | Tom Lane |
|---|---|
| Тема | Re: Slow query |
| Дата | |
| Msg-id | 18707.1098477434@sss.pgh.pa.us обсуждение |
| Ответ на | Slow query (Roger Ging <rging@paccomsys.com>) |
| Ответы |
Re: Slow query
|
| Список | pgsql-performance |
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
В списке pgsql-performance по дате отправления: