Thread: Time complexity of statements

Time complexity of statements

From
Sebastjan Trepca
Date:
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

Re: Time complexity of statements

From
Tom Lane
Date:
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

Re: Time complexity of statements

From
Peter Eisentraut
Date:
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/

Re: Time complexity of statements

From
Sebastjan Trepca
Date:
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/
>