Re: Updates, deletes and inserts are very slow. What can I do make them bearable?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Updates, deletes and inserts are very slow. What can I do make them bearable?
Date: 2010-10-21 04:05:28
Message-ID: 12136.1287633928@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tim Uckun <timuckun(at)gmail(dot)com> writes:
> I have a very simple update query.

> update cu
> set screenshot_file_name = tu.screenshot_file_name,
> screenshot_content_type = tu.screenshot_content_type,
> screenshot_file_size = tu.screenshot_file_size,
> screenshot_status = tu.screenshot_status
> from cu
> inner join tu on tu.cu_id = cu.id

That isn't actually the query you're issuing, because if it were
you would get an error "table name "cu" specified more than once".

I suspect that the query you're actually issuing involves an
unconstrained cartesian product self-join between the target table
and another instance of itself. Postgres doesn't consider that
the target table should be named again in FROM. But it's hard to
be sure about that when looking at a redacted query.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrej 2010-10-21 04:09:34 Re: Cannot Start Postgres After System Boot
Previous Message Vishnu S. 2010-10-21 04:04:31 How to Rejoin a Node after failover [Postgre SQL replication using Slony-I]