Re: Speed difference between select ... union select ... and select from partitioned_table
В списке pgsql-performance по дате отправления:
| От | Simon Riggs |
|---|---|
| Тема | Re: Speed difference between select ... union select ... and select from partitioned_table |
| Дата | |
| Msg-id | 1193520409.4242.604.camel@ebony.site обсуждение исходный текст |
| Ответ на | Speed difference between select ... union select ... and select from partitioned_table (Pablo Alcaraz <pabloa@laotraesquina.com.ar>) |
| Список | pgsql-performance |
On Fri, 2007-10-26 at 16:37 -0400, Pablo Alcaraz wrote: > I executed 2 equivalents queries. The first one uses a union structure. > The second uses a partitioned table. The tables are the same with 30 > millions of rows each one and the returned rows are the same. > > But the union query perform faster than the partitioned query. > > My question is: why? :) The two queries are equivalent but they have different execution plans. The UNION query has explicit GROUP BY operations within it. We do not currently perform a push-down operation onto the individual partitions. This results in more data copying as well as requiring a single very large sort, rather than lots of small ones. That is probably enough to allow it to perform the sort in memory rather than on-disk, thus allowing a considerable speed-up. This is on my list of requirements for further partitioning improvements in 8.4 or beyond. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера