[PERFORM] Data caching

2009-07-09 Thread Martin Chlupac
Hello everybody, I have a simple query which selects data from not very large table ( 434161 rows) and takes far more time than I'd expect. I believe it's due to a poor disk performance because when I execute the very same query for a second time I get much better results (caching kicks in?). Can

Re: [PERFORM] Data caching

2009-07-09 Thread Richard Huxton
Martin Chlupac wrote: Hello everybody, I have a simple query which selects data from not very large table ( 434161 rows) and takes far more time than I'd expect. I believe it's due to a poor disk performance because when I execute the very same query for a second time I get much better results

[PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Craig James
Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5). I need to sort by an arbitrary (i.e. user-specified) mapping of CATEGORY, something like this: 1 = 'z' 2 = 'a' 3 = 'b' 4 = 'w' 5 = 'h' So when I get done, the sort order should be 2,3,5,4,1. I

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Grzegorz Jaśkiewicz
On Thu, Jul 9, 2009 at 5:26 PM, Craig Jamescraig_ja...@emolecules.com wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5).  I need to sort by an arbitrary (i.e. user-specified) mapping of CATEGORY, something like this:  1 = 'z'  2 = 'a'  3 =

[PERFORM] Huge difference in query performance between 8.3 and 8.4 (possibly)

2009-07-09 Thread Robin Houston
[ Attempting to resend, because it didn't seem to get through last time. ] We have a query that runs very slowly on our 8.3 database. (I can't tell you exactly how slowly, because it has never successfully run to completion even when we left it running overnight.) On the 8.4 database on my

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Tom Lane
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= gryz...@gmail.com writes: On Thu, Jul 9, 2009 at 5:26 PM, Craig Jamescraig_ja...@emolecules.com wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5).  I need to sort by an arbitrary (i.e. user-specified)

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Kevin Grittner
Craig James craig_ja...@emolecules.com wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5). I need to sort by an arbitrary (i.e. user-specified) mapping of CATEGORY There was a recent thread discussing ways to do that:

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Alexander Staubo
On Thu, Jul 9, 2009 at 6:26 PM, Craig Jamescraig_ja...@emolecules.com wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5).  I need to sort by an arbitrary (i.e. user-specified) mapping of CATEGORY, something like this:  1 = 'z'  2 = 'a'  3 =

Re: [PERFORM] Huge difference in query performance between 8.3 and 8.4 (possibly)

2009-07-09 Thread Alvaro Herrera
Robin Houston escribió: We have a query that runs very slowly on our 8.3 database. (I can't tell you exactly how slowly, because it has never successfully run to completion even when we left it running overnight.) On the 8.4 database on my laptop, it runs in about 90 seconds. Of course there

Re: [PERFORM] Huge difference in query performance between 8.3 and 8.4 (possibly)

2009-07-09 Thread Tom Lane
Robin Houston robin.hous...@gmail.com writes: We have a query that runs very slowly on our 8.3 database. (I can't tell you exactly how slowly, because it has never successfully run to completion even when we left it running overnight.) On the 8.4 database on my laptop, it runs in about 90

[PERFORM] embedded sql regression from 8.2.4 to 8.3.7

2009-07-09 Thread Haszlakiewicz, Eric
I noticed a bit of a performance regression in embedded sql queries when moving from the client libraries in verison 8.2.4 to 8.3.7. My application does a whole lot of queries, many of which don't return any data. When we moved to the new libraries the time of running a query (from the

Re: [PERFORM] Huge difference in query performance between 8.3 and 8.4 (possibly)

2009-07-09 Thread Hartman, Matthew
From: pgsql-performance-ow...@postgresql.org [mailto:pgsql-performance- ow...@postgresql.org] On Behalf Of Robin Houston Sent: Thursday, July 09, 2009 12:35 PM We have a query that runs very slowly on our 8.3 database. (I can't tell you exactly how slowly, because it has never successfully

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread hubert depesz lubaczewski
On Thu, Jul 09, 2009 at 09:26:42AM -0700, Craig James wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5). I need to sort by an arbitrary (i.e. user-specified) mapping of CATEGORY, something like this: 1 = 'z' 2 = 'a' 3 = 'b' 4 = 'w'

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Hartman, Matthew
On Thu, Jul 09, 2009 at 09:26:42AM -0700, Craig James wrote: You can do it like this: select c.* from categories c, ( values (1, 'z'), (2, 'a'), (3, 'b'), (4, 'w'), (5, 'h') ) as o (id, ordering) on c.id = o.id order by o.ordering Another option would be: select c.* from categories c order

Re: [PERFORM] Sorting by an arbitrary criterion

2009-07-09 Thread Grzegorz Jaśkiewicz
2009/7/9 Tom Lane t...@sss.pgh.pa.us: =?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= gryz...@gmail.com writes: On Thu, Jul 9, 2009 at 5:26 PM, Craig Jamescraig_ja...@emolecules.com wrote: Suppose I have a large table with a small-cardinality CATEGORY column (say, categories 1..5).  I need to sort by