Skip site navigation (1) Skip section navigation (2)

Re: half the query time in an unnecessary(?) sort?

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Subject: Re: half the query time in an unnecessary(?) sort?
Date: 2005-04-26 05:45:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Josh Berkus wrote: [quoted out of order]
> Looking at your analyze, though, I think it's not the sort that's taking the 
> time as it is that the full sorted entity_id column won't fit in work_mem.  
> Try increasing it?

Yup, that indeed fixed this particular query since neither table was
particularly large.

> It still has to sort because the clustering isn't guarenteed to be 100%.   

I guess I was contemplating whether or not there are some conditions
where it could be 100% (perhaps combined with Hannu's read only
table speculation).

> However, such sorts should be very quick as they have little work to do.

True, so long as the table can fit in work-mem.   For much larger tables
IMHO it'd be nice to be able to simply do a seq-scan on them if there were
some way of knowing that they were sorted.

In response to

pgsql-performance by date

Next:From: Thomas F.O'ConnellDate: 2005-04-26 06:26:46
Subject: Re: pgbench Comparison of 7.4.7 to 8.0.2
Previous:From: Dave HeldDate: 2005-04-25 22:41:41
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group