Re: Query question - Mailing list pgsql-performance

From Josh Berkus
Subject Re: Query question
Date
Msg-id 200311122120.28882.josh@agliodbs.com
Whole thread Raw
In response to Query question  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: Query question  (Neil Conway <neilc@samurai.com>)
List pgsql-performance
Chris,

> SELECT * FROM (arbitrary subquery) AS sub ORDER BY 1,3;
>
> Now, this all works fine, but I want to know if this is efficient or not.
>
> Does doing a select of a select cause serious performance degradation?

It would be better if you could strip out the inner sort, but I can understand
why that might not be possible in all cases.

The only thing you're adding to the query is a second SORT step, so it
shouldn't require any more time/memory than the query's first SORT did.

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-performance by date:

Previous
From: Rod Taylor
Date:
Subject: Re: performance optimzations
Next
From: Suchandra Thapa
Date:
Subject: Re: performance optimzations