Skip site navigation (1) Skip section navigation (2)

Re: Question regarding indices

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Steve" <steeeeeveee(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question regarding indices
Date: 2010-09-11 15:04:16
Message-ID: 17448.1284217456@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
"Steve" <steeeeeveee(at)gmx(dot)net> writes:
> 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?

It's unlikely to make enough difference to be worth the trouble.

			regards, tom lane

In response to

Responses

pgsql-sql by date

Next:From: LewDate: 2010-09-11 15:08:00
Subject: Re: Question regarding indices
Previous:From: SteveDate: 2010-09-11 12:44:23
Subject: Question about PQexecParams

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group