Thread: Time complexity of statements
Hi everybody! As I understood from books and docs every statement in Postgres takes O(1) because of it's versioning system, right? I'm talking about INSERT,UPDATE,SELECT and DELETE statement. Is it true? or did I get it wrong. I'm specially interested in UPDATE statement. We'll have lots of them. Thanks, Sebastjan
Sebastjan Trepca <trepca@gmail.com> writes: > As I understood from books and docs every statement in Postgres takes > O(1) because of it's versioning system, right? Finding an existing row is not O(1), so this is not the case for anything but INSERT. You also have to consider index update costs, foreign key checking costs if applicable, etc etc. regards, tom lane
Am Dienstag, 14. Februar 2006 16:13 schrieb Sebastjan Trepca: > As I understood from books and docs every statement in Postgres takes > O(1) because of it's versioning system, right? Absolutely not. -- Peter Eisentraut http://developer.postgresql.org/~petere/
Ok, thanks. I guess that was a stupid question, sorry :) I guess we'll have to use INSERTs instead of UPDATEs. Sebastjan On 2/14/06, Peter Eisentraut <peter_e@gmx.net> wrote: > Am Dienstag, 14. Februar 2006 16:13 schrieb Sebastjan Trepca: > > As I understood from books and docs every statement in Postgres takes > > O(1) because of it's versioning system, right? > > Absolutely not. > > -- > Peter Eisentraut > http://developer.postgresql.org/~petere/ >