Batch updates to 1 column using python-pgsql in multiple rows

Поиск
Список
Период
Сортировка
От Abhijeet R
Тема Batch updates to 1 column using python-pgsql in multiple rows
Дата
Msg-id 503E2000.2010207@gmail.com
обсуждение исходный текст
Ответы Re: Batch updates to 1 column using python-pgsql in multiple rows  (Josh Kupershmidt <schmiddy@gmail.com>)
Список pgsql-novice
Hi guys,

I have to update a certain column of a table at many rows. (order of
thousands).

For now, I am using a prepare statement and executing the queries like:

query = "UPDATE mytable SET myvar = $1 WHERE myvar2=$2"
db.execute(query, (var, var1)) #db is my connection object

But, I still feel like I can make it faster by using db.executemany()
method.  The thing is I am not able to get the syntax of it.

Can anyone please guide me as to how do I do batch updates in the
fastest possible manner? Also, will executemany() really be faster? If
so, how does that result in faster batch updates?

--
Regards,
Abhijeet
http://blog.abhijeetr.com



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

Предыдущее
От: Bartosz Dmytrak
Дата:
Сообщение: Re: Problem with CREATE TRIGGER
Следующее
От: Tom Lane
Дата:
Сообщение: Re: question about logging_collector