Re: Optimizing projections containing unused columns - Mailing list pgsql-general

From Andrus
Subject Re: Optimizing projections containing unused columns
Date
Msg-id 38A13F21B5834B21BA31C5170E18E24A@andrusnotebook
Whole thread Raw
In response to Re: Opptimizing projections containing unused columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Optimizing projections containing unused columns  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Tom,

> This question is too vague to be answerable --- especially if you want
> an answer that applies across all 8.x releases.  I'd suggest
> experimenting a bit using EXPLAIN ANALYZE to see what happens in your
> actual application.

Thank you very much.
I cannot experiment with application currently since this part is at
planning state.
I asked this to get right designing direction.

OK, I will create applicaton so that inner WHERE clauses contain as much
restrictions as it is possible without adding additional tables to
inner SELECTs. Hopefully this cannot be slower than moving those
restrictions to outer select.

A third related issue:

Is it OK to use 5 levels of nested queries like

SELECT ...
  FROM ...
   (SELECT ..       FROM  ...
       (SELECT ... FROM ..
    ...
    )  p1
    ) p2

or is it better to create queries with as few levels of nestings as possible
?
In some cases we have selection to use UNIONS, JOINS and CREATE TEMP TABLE x
ON COMMIT DROP clauses instead of nested queries but
nested queries look more natural to create.

Currently we are planning to support servers starting at 8.0 so we are not
planning to use WITH statement.

Andrus


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Opptimizing projections containing unused columns
Next
From: Tom Lane
Date:
Subject: Re: Drupal and PostgreSQL - performance issues?