Re: UPDATE many records
От | Israel Brewster |
---|---|
Тема | Re: UPDATE many records |
Дата | |
Msg-id | 1E69AD3D-76C5-4300-AB5B-E75CE9E1E9DE@alaska.edu обсуждение исходный текст |
Ответ на | Re: UPDATE many records (Michael Lewis <mlewis@entrata.com>) |
Ответы |
RE: UPDATE many records
Re: UPDATE many records |
Список | pgsql-general |
On Jan 6, 2020, at 11:54 AM, Michael Lewis <mlewis@entrata.com> wrote:I’m thinking it might be worth it to do a “quick” test on 1,000 or so records (or whatever number can run in a minute or so), watching the processor utilization as it runs. That should give me a better feel for where the bottlenecks may be, and how long the entire update process would take. I’m assuming, of course, that the total time would scale more or less linearly with the number of records.I think that depends on how your identify and limit the update to those 1000 records. If it is using a primary key with specific keys in an array, probably close to linear increase because the where clause isn't impactful to the overall execution time. If you write a sub-query that is slow, then you would need to exclude that from the time. You can always run explain analyze on the update and rollback rather than commit.
One potentially significant note: most of the execution time is spent in a trigger. This trigger is actually what’s doing the REAL update that I need to happen. If it would make a difference, I could easily pull the trigger code out to a separate function that I just call directly (with triggers temporarily disabled). My thinking is that calling a function is calling a function, and the fact that it is currently called via a trigger rather than direct is of little consequence, but I’m willing to be corrected on that :-)
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory
Geophysical Institute - UAF
2156 Koyukuk Drive
Fairbanks AK 99775-7320
Software Engineer
Alaska Volcano Observatory
Geophysical Institute - UAF
2156 Koyukuk Drive
Fairbanks AK 99775-7320
Work: 907-474-5172
cell: 907-328-9145
cell: 907-328-9145
В списке pgsql-general по дате отправления: