Performance when upgrading using a cursor in PostgreSQL

I would like to know the difference in performance when updating a table using the following method:

UPDATE films SET kind = 'Dramatic' WHERE CURRENT OF c_films;

or like this:

UPDATE films SET kind = 'Dramatic' WHERE unique_indexed_int_column = 3000;

Has anyone checked this out or found out how updates work with cursors so they can comment on this?

EDIT: Now I compared this and found that it actually works about a third faster to make the last example. I ran each of the requests 100,000 times and timed the difference. I used psycopg2 with server cursors to communicate with Postgres. Next, I will investigate if I can find that this is not always the case.

0
source share
1 answer

PostgreSQL, .

, indexed_int_column , , , c_films. , .

c_films , indexed_int_column = 3000, , , , , , , 3000, . , ( ). , , , , , , .

+1

All Articles