Re: [PERFORM] Sorted group by

2010-08-10 Thread Jonathan Blitz
Another couple of possible ways: Select groupfield,value >From tbl x1 Where number = (select max(number) from tbl x2 where x2.groupfield= x1.groupfield) Select groupfield,value >From tbl x1 Where (groupfield,number) in (select groupfield,max(number) from tbl group by groupfield) Which is qui

Re: [PERFORM] Why is the query not using the index for sorting?

2009-11-23 Thread Jonathan Blitz
Definitely after. Jonathan -Original Message- From: pgsql-performance-ow...@postgresql.org [mailto:pgsql-performance-ow...@postgresql.org] On Behalf Of Matthew Wakeling Sent: Monday, November 23, 2009 1:00 PM To: Jonathan Blitz Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM

Re: [PERFORM] Why is the query not using the index for sorting?

2009-11-22 Thread Jonathan Blitz
Many thanks. I'll give it a try and see what happens. -Original Message- From: Craig Ringer [mailto:cr...@postnewspapers.com.au] Sent: Sunday, November 22, 2009 3:25 PM To: Jonathan Blitz Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Why is the query not using the

[PERFORM] Why is the query not using the index for sorting?

2009-11-22 Thread Jonathan Blitz
performs a sort. Am I missing something? Jonathan Blitz

Re: [PERFORM] Propagating outer join conditions

2006-12-03 Thread Jonathan Blitz
How about trying: Select * From (Select * from t28 where t28.0='spec') t28a Left out join (t1 JOIN t11 ON > (t11.o = '<http://example.org>' AND t11.s = t1.o)) ON t28a.s = t1.s In this way, I think, the where clause on t28 would be performed before the join rathe

Re: [PERFORM] Adding and filling new column on big table

2006-05-30 Thread Jonathan Blitz
> > Most laptop drives are only 5,400 RPM which would make a transaction like > you are describing likely take a while. Not sure what my one is but it is new(ish). > > No desktop at home you could try it on? > I think the problem with the laptop is likely it's drive. I suppose I could do but I

Re: [PERFORM] Adding and filling new column on big table

2006-05-30 Thread Jonathan Blitz
> > > Could you do the updates in batches instead of trying to do them all at > once? Nope. Didn't think it would make any difference. > > Have you done a vacuum full on this table ever? Many times > > What hardware? > I have a dual CPU opteron with 4GB of RAM and 8 disks in RAID 10 (SATA).

Re: [PERFORM] Adding and filling new column on big table

2006-05-30 Thread Jonathan Blitz
> > So, I have tried to run the following command. The command never finishes > > (I gave up after about and hour and a half!). > > Did you ever find what was the problem? > Perhaps you needed to run a vacuum full on the table? Nope. I just gave up in the end and left it with NULL as the default

Re: [PERFORM] slow query using sub select

2006-05-22 Thread Jonathan Blitz
802158) order by batterydescription. How about changing it into a standard join: select t1.batterycode, t1.batterydescription, t2.observationdate from Battery t1, (Select batterycode ,max(observationdate) from Battery t2 where patientidentifier=611802158 group by batterycode) AS T2 where t1. bat

[PERFORM] Adding and filling new column on big table

2006-05-16 Thread Jonathan Blitz
should be fast enough.   Any ideas?   Jonathan Blitz   -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.6/340 - Release Date: 05/15/2006