Sebastjan Trepca <trepca(at)gmail(dot)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