From: | beickhof(at)Lexmark(dot)com |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Can this function be declared IMMUTABLE? |
Date: | 2007-08-28 16:37:12 |
Message-ID: | OF4DD06474.754D7E6E-ON85257345.005B2737-85257345.005B44ED@lexmark.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have a question about whether I can safely declare a function IMMUTABLE.
Citing the PostgreSQL documentation under "Function Volatility
Categories" in the section on "Extending SQL":
----------------------------------------
It is generally unwise to select from database tables within an IMMUTABLE
function at all, since the immutability will be broken if the table
contents ever change.
----------------------------------------
Well, I am considering a function that does select from a table, but the
table contents change extremely infrequently (the table is practically a
list of constants). Would it be safe to declare the function IMMUTABLE
provided that the table itself is endowed with a trigger that will drop
and recreate the function any time the table contents are modified? In
this way, it seems that the database would gain the performance benefit of
an immutable function for the long stretches of time in between changes to
the table.
I apologize that I don't have any details -- it is still very early in the
development of the database design, and I was just hoping to get a better
understanding of whether an immutable function would safely offer any
benefit in this scenario.
Thanks very much,
Bobby
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2007-08-28 16:38:44 | Re: 8.1.10 release? |
Previous Message | Madison Kelly | 2007-08-28 16:28:40 | OT? Courier + PgSQL problem |