Re: Large CASE-statement is pretty slow?

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Large CASE-statement is pretty slow?
Дата
Msg-id 87y8q22fr2.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Large CASE-statement is pretty slow?  (Arjen van der Meijden <acmmailing@vulcanus.its.tudelft.nl>)
Ответы Re: Large CASE-statement is pretty slow?
Список pgsql-performance
Arjen van der Meijden <acmmailing@vulcanus.its.tudelft.nl> writes:

>
> Of course I wanted to know how long it'd take on postgresql, selecting the
> pkey-field only (without the case) took also some 0.7 seconds (the entire table
> may have been more).
> But the CASE-version took 9026139.201 ms, i.e. over 9000 seconds about 8 times
> slower than MySQL.

Was this the select with the CASE, or the update?

If you did the update and have lots of foreign key references to the table
then every record that's updated forces a check to make sure there are no
references to that record (or an update if it's ON UPDATE CASCADE). If there
are no indexes on the referencing table columns that will be very slow.

--
greg

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

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: [ADMIN] syslog slowing the database?
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Large CASE-statement is pretty slow?