pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve <steeeeeveee@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question regarding indices
Date: Sat, 11 Sep 2010 11:04:16 -0400
Message-ID: <17448.1284217456@sss.pgh.pa.us> (raw)
In-Reply-To: <20100911122923.75010@gmx.net>
References: <20100911122923.75010@gmx.net>

"Steve" <steeeeeveee@gmx.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



view thread (8+ messages)  latest in thread

Message-ID: <17448.1284217456@sss.pgh.pa.us>
Permalink:  ../17448.1284217456@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17448.1284217456@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, steeeeeveee@gmx.net
  Subject: Re: Question regarding indices
  In-Reply-To: <17448.1284217456@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox