| От | Tom Lane |
|---|---|
| Тема | Re: Mechanics of Select |
| Дата | |
| Msg-id | 11648.1202687109@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Mechanics of Select (Willem Buitendyk <willem@pcfish.ca>) |
| Список | pgsql-general |
Willem Buitendyk <willem@pcfish.ca> writes:
> I have the following function that returns the first day of the next
> month from whatever date is inserted. If I use this as part of a select
> statement then it takes almost twice as long to perform. Is this
> because for each scanned record this function is being called? If so
> any ideas how I could make this only occur once?
Don't declare it VOLATILE, when (AFAICS) you have no reason to.
It would be evaluated only once if it were marked IMMUTABLE.
BTW, I think you're doing it the hard way --- this could almost
certainly be a one-liner if you were using the available date
arithmetic facilities.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера