Re: optimizing common subqueries

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: optimizing common subqueries
Date: 2005-10-05 15:23:20
Message-ID: e6e421135b4e92e6d5d858980ccfed7d@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

As I understand it, Postgres's query planner considers only trees of
joins - I don't know what the technical implications are of using DAG
plans, other than the obvious blowup in planning space.

I was recently in a similar situation, where a script essentially
needed to do a self-join on the result of a complex query. The script
uses a temp table to store the results of the first query, and then
does a second query using the temp table - effectively, I have done
common-subexpression reduction by hand. This repeated fragment of your
example:

SELECT * FROM common_pmids('mycn','trka')

might be a candidate for such treatment.

- John Burger
MITRE

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message L van der Walt 2005-10-05 15:27:22 Re: Securing Postgres
Previous Message Tom Lane 2005-10-05 15:22:51 Re: Securing Postgres