On 7dic, 2010, at 15:45 , Michał Roszka wrote:

> Quoting Raimon Fernandez <co...@montx.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?

no, there's no check or constraint (no foreign key, ...) on this field.

I'm using now another database with same structure and data and the delay 
doesn't exist there, there must be something wrong in my current development 
database.

I'm checking this now ...

thanks,

r.


> 
> Cheers,
> 
>   -Mike
> 
> --
> Michał Roszka
> m...@if-then-else.pl
> 
> 



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to