Question regarding indices

From: "Steve" <steeeeeveee(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Question regarding indices
Date: 2010-09-11 12:29:23
Message-ID: 20100911122923.75010@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve 2010-09-11 12:44:23 Question about PQexecParams
Previous Message Thomas Kellerer 2010-09-10 10:07:37 Re: sql disaster - subquery error but delete continues