Re: [GENERAL] Query optimisation and sorting on external merge

2009-07-29 Thread Jake Stride
Thanks I'll take a look into it - they query you provide seems to take longer in the query plan but I can see where you are coming from and it's good base to work from. Jake -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.pos

Re: [GENERAL] Query optimisation and sorting on external merge

2009-07-29 Thread Jake Stride
2009/7/29 A. Kretschmer : > In response to Jake Stride : >> Hi, >> >> I'm trying to optimise a query at the moment, I've added some new >> indexes to stop seq scans, but I'm now trying to work out if I can >> stop a join using external sort to speed up the query. I've included > > Increase work_mem

Re: [GENERAL] Query optimisation and sorting on external merge

2009-07-29 Thread nha
Hello, Le 29/07/09 13:46, Jake Stride a écrit : > Hi, > > I'm trying to optimise a query at the moment, I've added some new > indexes to stop seq scans, but I'm now trying to work out if I can > stop a join using external sort to speed up the query. I've included > an explain analyze below and wo

Re: [GENERAL] Query optimisation and sorting on external merge

2009-07-29 Thread A. Kretschmer
In response to Jake Stride : > Hi, > > I'm trying to optimise a query at the moment, I've added some new > indexes to stop seq scans, but I'm now trying to work out if I can > stop a join using external sort to speed up the query. I've included Increase work_mem to force sort in memory. Andreas

[GENERAL] Query optimisation and sorting on external merge

2009-07-29 Thread Jake Stride
Hi, I'm trying to optimise a query at the moment, I've added some new indexes to stop seq scans, but I'm now trying to work out if I can stop a join using external sort to speed up the query. I've included an explain analyze below and would appreciate any pointers to gaps in my understanding. exp

Re: [GENERAL] Query optimisation

2008-04-06 Thread Craig Ringer
Naz Gassiep wrote: > As you can see, they all are the same table, just repeatedly joined with > aliases. Sorry, I'm obviously blind. -- Craig Ringer -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pg

Re: [GENERAL] Query optimisation

2008-04-06 Thread Naz Gassiep
As you can see, they all are the same table, just repeatedly joined with aliases. The images table has several fields, each one referring to a different sized version of the image. It then has to join against the files table for each size to get the file that corresponds with that image version

Re: [GENERAL] Query optimisation

2008-04-06 Thread Tom Lane
Craig Ringer <[EMAIL PROTECTED]> writes: > That's a whole lot of joins. See join_collapse_limit ... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-gene

Re: [GENERAL] Query optimisation

2008-04-06 Thread Craig Ringer
Naz Gassiep wrote: > JOIN files imageid_file ON (images.imageid = > imageid_file.fileid) > JOIN files size120_file ON (images.size120 = > size120_file.fileid) > JOIN files size240_file ON (images.size240 = > size240_file.fileid) > JOI

[GENERAL] Query optimisation

2008-04-06 Thread Naz Gassiep
The following query is executing in a long time, 500ms or so. This needs to be about 100ms or so in order to be acceptable. Can anyone spot any optimisations that I could make to this query to bring the exec time down? Have I designed this query correctly? Is joining to the same table every time