-------- Original-Nachricht --------
> Datum: Sat, 11 Sep 2010 10:05:18 -0400
> Von: Michael Gould <mgould@intermodalsoftwaresolutions.net>
> An: Steve <steeeeeveee@gmx.net>
> Betreff: Re: [SQL] Question regarding indices
> Steve,
>
Hello Michael,
> If I remember correctly the sort only works on the final result set and so
> doing a sort before the select isn't going to help
>
I think you got me wrong. It's not that I want the RESULT to be sorted. I only asked if sorting the values in the query
wouldhave an effect on the speed of the query.
Or to ask it the other way around: Is an index in PostgreSQL sorted or not? If it is sorted and the PostgreSQL parser
islooking for entries in the index then having the values pre-sorted would probably be beneficial. Right?
// Steve
> Sent from Samsung mobile
>
> Steve <steeeeeveee@gmx.net> wrote:
>
> >Hello List,
> >
> >I have a small question about the order of values in a query. Assume I
> have a table with the following fields:
> > uid INT,
> > data BIGINT,
> > hits INT
> >
> >And an unique index on (uid, data). I use libpq C API to query data from
> the table. The query is something like this:
> >SELECT uid,data,hits FROM mytable WHERE uid=2 AND data IN
> (2033,2499,590,19,201,659)
> >
> >Would the speed of the query be influenced if I would sort the data? I
> can imagine that just querying a bunch of bigint would not make a big
> difference but what about several thousand of values? Would sorting them and
> sending the SQL query with ordered data influence the speed of the query?
> >
> >
> >// Steve
> >--
> >GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
> >Jetzt freischalten! http://portal.gmx.net/de/go/maxdome
> >
> >--
> >Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> >To make changes to your subscription:
> >http://www.postgresql.org/mailpref/pgsql-sql
--
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome