Re: Slow update
От | Herouth Maoz |
---|---|
Тема | Re: Slow update |
Дата | |
Msg-id | 49770BE9.50804@unicell.co.il обсуждение исходный текст |
Ответ на | Re: Slow update ("Marc Mamin" <M.Mamin@intershop.de>) |
Ответы |
Re: Slow update
|
Список | pgsql-general |
Marc Mamin wrote:
I don't see why it would. As far as I know, the high saving in update time is done by using the indices. All the other conditions that are not on indices are all checked using a sequential scan on the rows that were brought from the index, so adding more conditions wouldn't make this a lot faster - maybe even slower because more comparisons are made.Hello,- did you vacuum your tables recently ?- What I miss in your query is a check for the rows that do not need to be udated:AND NOT (service = b.serviceAND status = b.statusAND has_notification = gateway_id NOT IN (4,101,102)AND operator = COALESCE( b.actual_target_network_id, b.requested_target_network_id )depending on the fraction of rows that are already up to date, the might fasten your process quite a lot...
In any case, the logic of the database is that the records that have delivered = 0 are always a subset of the records that are changed in this query, so querying on delivered=0 - which is an indexed query - actually make the above redundant.
Thanks for your response,
Herouth
В списке pgsql-general по дате отправления: