Re: Problem with result ordering

From: Thorsten Körner <t(dot)koerner(at)cappuccinosoft(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with result ordering
Date: 2007-01-25 18:00:46
Message-ID: 200701251900.47052.t.koerner@cappuccinosoft.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Fillip,

thanks for your hint, I have tested it on a development database, and it
worked well.
Are there any experiences how this will affect performance on a large
database, with very high traffic?
Is it recommended to use temp tables in such an environment?

THX in advance
Thorsten

Am Donnerstag, 25. Januar 2007 17:02 schrieb Filip Rembiałkowski:
> 2007/1/25, Thorsten Körner <t(dot)koerner(at)cappuccinosoft(dot)de>:
> > Hi,
> >
> > when I fire the following query:
> > select m_id, m_u_id, m_title, m_rating from tablename where m_id in
> > (26250, 11042, 16279, 42197, 672089);
> >
> > I will get the same results in the same order, as in in the next query:
> > select m_id, m_u_id, m_title, m_rating from tablename where m_id in
> > (11042,42197,672089,26250,16279);
> >
> > I wonder, how it is possible, to retrieve the results in the same order,
> > as queried in the list. The listed IDs are from an application outside
> > the database.
> >
> > Version is PostgreSQL 8.2.1
> >
> > Has anyone an idea, how to do this, while PostgreSQL knows nothing about
> > hints, like oracle does?
>
> obvious solution is to create temporary table like
> create temp table tmp ( id serial, key integer );
> then populate it with your list in order,
> and then join it with your source table.
>
> but it will require some extra coding, either in your app or in PL
> set-returning function
>
> F.

--
CappuccinoSoft Business Systems
Hamburg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-01-25 18:34:50 Re: sequence increment jumps?
Previous Message Bruno Wolff III 2007-01-25 17:56:07 Re: sequence increment jumps?