Re: Caching (was Re: choosing the right platform)
От
Josh Berkus
Тема
Re: Caching (was Re: choosing the right platform)
Дата
Msg-id
200304110915.15060.josh@agliodbs.com
Ответ на
Список
Дерево обсуждения
Caching (was Re: choosing the right platform) "Matthew Nuzum" <cobalt@bearfruit.org>
Re: Caching (was Re: choosing the right platform) Ron Johnson <ron.l.johnson@cox.net>
Re: Caching (was Re: choosing the right platform) Josh Berkus <josh@agliodbs.com>
Re: Caching (was Re: choosing the right platform) "Ron Mayer" <ron@intervideo.com>
Re: Caching (was Re: choosing the right platform) Josh Berkus <josh@agliodbs.com>
Re: Caching (was Re: choosing the right platform) "Ron Mayer" <ron@intervideo.com>
Re: Caching (was Re: choosing the right platform) "scott.marlowe" <scott.marlowe@ihs.com>
Re: Caching (was Re: choosing the right platform) David McKain <dmckain1@ph.ed.ac.uk>
Re: Caching (was Re: choosing the right platform) Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
Ron, > In a data warehouse we have here, we load about 3 million rows > each week; load time improved from about 9 to 7 hours > by breaking up such queries into expressions that only require > one sort at a time, and surrounding the expressions with > "set sort_mem=something_big" statements to give it enough > space to not hit the disk. > > SET SORT_MEM=300000; > CREATE TEMPORARY TABLE potential_new_values AS > SELECT DISTINCT val FROM import_table; > ... > SET SORT_MEM=1000; > > Anyone else have similar experience, or am I doing something > wrong to need so much SORT_MEM? No, this sounds very reasonable to me. I do a similar operation on one of my systems as part of a nightly data transformation for reporting. Since I haven't had to do those on tables over 150,000 rows, I haven't seen the kind of RAM usage you experience. > Below is an example of another real-world query from the same > reporting system that benefits from a sort_mem over 32M. > Explain analyze (below) shows a 40% improvement by having > the sort fit in memory. Cool! That's a perfect example of sizing sort_mem for the query. Mind if I steal it for an article at some point? -- Josh Berkus Aglio Database Solutions San Francisco
В списке pgsql-performance по дате отправления