Re: function for setting/getting same timestamp during whole transaction

From: Miroslav Šimulčík <simulcik(dot)miro(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Misa Simic <misa(dot)simic(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: function for setting/getting same timestamp during whole transaction
Date: 2013-02-06 12:06:18
Message-ID: CAHRNM69nMnxxyoQ6C99hh6vJuepAtqXwARomN=nVb6Pmvdyc=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

>
> probably you can use a little bit cheaper session variables
>

I rejected session variables, because they don't get cleared at the end of
transaction if somebody set value on session level. So I can't decide if
new transaction started.

this is good (variable is cleared at the end of transaction):
begin;
set local test.value to 123;
show test.value;
test.value
------------
123
commit;
show test.value; --cleared => transaction ended
test.haha
-----------

but this is bad:
begin;
set local test.value to 123;
show test.value;
test.value
------------
123
set test.value to 456;
commit;
show test.value; --not cleared
test.haha
-----------
456

> test to system tables is slower then trapping error - just try to read
> from tmp and when a read fails, then create table
>

Ok I will try reading from temp table directly with error trapping and
compare times.

> probably C trigger can be very effective, possible to use this
> technique - http://postgres.cz/wiki/Funkce_rownum%28%29 (sorry, it is
> in Czech language)
>

I'm from Slovakia so I don't have problem with czech language, but I'm not
sure how to do it in C function without using temp table, because I need to
clear variable at the end/start of transaction. Any hints?

Miro

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-02-06 12:16:06 Re: Need help understanding WAL and checkpoints
Previous Message Craig Ringer 2013-02-06 12:06:08 Re: function for setting/getting same timestamp during whole transaction

Browse pgsql-hackers by date

  From Date Subject
Next Message Miroslav Šimulčík 2013-02-06 12:26:40 Re: function for setting/getting same timestamp during whole transaction
Previous Message Craig Ringer 2013-02-06 12:06:08 Re: function for setting/getting same timestamp during whole transaction