From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | wolfgang(at)alle-noten(dot)de |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: pg/tcl performance related |
Date: | 2018-03-09 16:43:00 |
Message-ID: | 26361.1520613780@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
wolfgang(at)alle-noten(dot)de writes:
> Now, for pl/tcl, I could use either
> create function check(text) returns text as $$
> set data {
> # the data value
> }
> foreach d $data {
> # the work
> }
> $$ language pltcl;
> or
> create function check(text) returns text as $$
> if ![info exists GD(data)] {
> set GD(data) {
> # the data value
> }
> }
> foreach d $GD(data) {
> # the work
> }
> $$ language pltcl;
> Does this make any difference - i.e. how often will parsing the data happen?
Obviously, in the first case the "set data" will happen every time you
call the function. The cost of that should be about the same as it
would be in standalone Tcl. PL/Tcl builds a Tcl code object for the
function body on first call in a session, and thereafter reuses that
code object, so that you shouldn't have extra parsing overhead per
se ... but execution of the command costs something too.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jeremy Finzel | 2018-03-09 16:43:20 | ERROR could not access transaction/Could not open file pg_commit_ts |
Previous Message | Melvin Davidson | 2018-03-09 15:15:44 | Re: Postgresql upgrade to 9.5.12/10.3 changes pg_dump format for cloning schemas |