From: | "Steve" <steeeeeveee(at)gmx(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Question regarding indices |
Date: | 2010-09-11 17:08:37 |
Message-ID: | 20100911170837.240190@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
-------- Original-Nachricht --------
> Datum: Sat, 11 Sep 2010 10:05:18 -0400
> Von: Michael Gould <mgould(at)intermodalsoftwaresolutions(dot)net>
> An: Steve <steeeeeveee(at)gmx(dot)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 would have 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 is looking for entries in the index then having the values pre-sorted would probably be beneficial. Right?
// Steve
> Sent from Samsung mobile
>
> Steve <steeeeeveee(at)gmx(dot)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(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Steve | 2010-09-11 17:23:32 | Re: Question regarding indices |
Previous Message | Lew | 2010-09-11 15:08:00 | Re: Question regarding indices |