Re: SELECT is immediate but the UPDATE takes forever

From: Michał Roszka <mike(at)if-then-else(dot)pl>
To: Raimon Fernandez <coder(at)montx(dot)com>
Cc: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT is immediate but the UPDATE takes forever
Date: 2010-12-07 14:45:37
Message-ID: 20101207154537.81utnyfeo00cwgwg@horde.iq.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Quoting Raimon Fernandez <coder(at)montx(dot)com>:

> I want to understand why one of my postgresql functions takes an
> eternity to finish.
>
> Here's an example:
>
> UPDATE comptes SET belongs_to_compte_id=42009 WHERE (codi_compte LIKE
> '10000%' AND empresa_id=2 AND nivell=11); // takes forever to finish

[...]

> but the same SELECT count, it's immediate:
>
> SELECT count(id) FROM comptes WHERE codi_compte LIKE '10000%' AND
> empresa_id=2 AND nivell=11;

Maybe there is any check or constraint on belongs_to_compte_id.comptes that
might take longer?

Cheers,

-Mike

--
Michał Roszka
mike(at)if-then-else(dot)pl

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message paulo matadr 2010-12-07 15:12:12 restore In parallel postgres 9
Previous Message Michael C Rosenstein 2010-12-07 14:28:27 Re: Do we want SYNONYMS?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Raimon Fernandez 2010-12-07 15:14:28 Re: SELECT is immediate but the UPDATE takes forever
Previous Message Raimon Fernandez 2010-12-07 11:11:27 SELECT is immediate but the UPDATE takes forever