Re: Views versus user-defined functions: formatting, comments, performance, etc.
В списке pgsql-general по дате отправления:
| От | Craig Ringer |
|---|---|
| Тема | Re: Views versus user-defined functions: formatting, comments, performance, etc. |
| Дата | |
| Msg-id | 502F5188.9080208@ringerc.id.au обсуждение исходный текст |
| Ответ на | Re: Views versus user-defined functions: formatting, comments, performance, etc. (Merlin Moncure <mmoncure@gmail.com>) |
| Список | pgsql-general |
On 08/18/2012 06:49 AM, Merlin Moncure wrote: > For various reasons, this often goes the wrong way. Views are often > the right way to go. Indeed. I've had queries speed up *hundreds* of times when I convert a function the planner didn't seem to want to inline into a view it can push conditions down into. The key thing to remember with views is that - unlike CTE "WITH" expressions - they generally aren't fully evaluated to get all their rows if most of them aren't needed. The query optimiser can typically push filters (like "where customer_id = 4" or whatever) down into the index- and table-scans used by the view, reducing the amount of data that has to be processed. That's not always the case, so use of EXPLAIN ANALYZE and some tweaking of a view or query that uses a view is sometimes necessary. Mostly it "just works" though. -- Craig Ringer
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера