On Wed, Jun 17, 2009 at 8:33 AM, Albe Laurenz<laurenz.albe@xxxxxxxxxx> wrote: > > I don't understand your data model well enough to understand > the query, so I can only give you general hints (which you probably > already know): He is effectively joining same table 4 times in a for loop, to get result, this is veeery ineffective. imagine: for(x) for(x) for(x) for(x) .. where X is number of rows in table matrix. not scarred yet ? -- GJ -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance