Search Postgresql Archives

Re: Slow update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marc Mamin wrote:

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.service
               AND status = b.status
              AND 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...
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.

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux