Re: immutable functions vs. join for lookups ?
| От | Jaime Casanova |
|---|---|
| Тема | Re: immutable functions vs. join for lookups ? |
| Дата | |
| Msg-id | c2d9e70e05041701372aee3a2c@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: immutable functions vs. join for lookups ? (Enrico Weigelt <weigelt@metux.de>) |
| Ответы |
Re: immutable functions vs. join for lookups ?
|
| Список | pgsql-performance |
On 4/17/05, Enrico Weigelt <weigelt@metux.de> wrote: > * Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Enrico Weigelt <weigelt@metux.de> writes: > > > c) CREATE FUNCTION id2username(oid) RETURNS text > > > LANGUAGE 'SQL' IMMUTABLE AS ' > > > SELECT username AS RESULT FROM users WHERE uid = $1'; > > > > This is simply dangerous. The function is *NOT* immutable (it is > > stable though). When ... not if ... your application breaks because > > you got the wrong answers, you'll get no sympathy from anyone. > > In my case it is immutable. The username never changes. > Even if your data never changes it *can* change so the function should be at most stable not immutable. regards, Jaime Casanova
В списке pgsql-performance по дате отправления: