SELECT is immediate but the UPDATE takes forever

Поиск
Список
Период
Сортировка
От Raimon Fernandez
Тема SELECT is immediate but the UPDATE takes forever
Дата
Msg-id DC307393-7759-4E60-B9E8-5675B31584F2@montx.com
обсуждение исходный текст
Ответ на Re: Extended Query, flush or sync ?  (Raimon Fernandez <coder@montx.com>)
Ответы Re: SELECT is immediate but the UPDATE takes forever  (Michał Roszka <mike@if-then-else.pl>)
Список pgsql-general
Hi,


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); //
takesforever to finish 

QUERY PLAN
--------------------------------------------------------------------------------------------
 Seq Scan on comptes  (cost=0.00..6559.28 rows=18 width=81)
   Filter: (((codi_compte)::text ~~ '10000%'::text) AND (empresa_id = 2) AND (nivell = 11))
(2 rows)


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;


what I'm doing wrong ?

thanks,

regards,

r.

В списке pgsql-general по дате отправления:

Предыдущее
От: "kobi.biton"
Дата:
Сообщение: Re: if-clause to an exiting statement
Следующее
От: Michał Roszka
Дата:
Сообщение: Re: SELECT is immediate but the UPDATE takes forever