Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E583D632DA0 for ; Sat, 11 Sep 2010 09:29:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 53669-02 for ; Sat, 11 Sep 2010 12:29:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.22]) by mail.postgresql.org (Postfix) with SMTP id BC532632D2D for ; Sat, 11 Sep 2010 09:29:27 -0300 (ADT) Received: (qmail 11628 invoked by uid 0); 11 Sep 2010 12:29:24 -0000 Received: from 193.247.250.11 by www025.gmx.net with HTTP; Sat, 11 Sep 2010 14:29:23 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Sat, 11 Sep 2010 14:29:23 +0200 From: "Steve" Message-ID: <20100911122923.75010@gmx.net> MIME-Version: 1.0 Subject: Question regarding indices To: pgsql-sql@postgresql.org X-Authenticated: #26630975 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX193Gyl3nmJ3X8QetHWWznU7thAejet9wLyhix5uOz a7lMMhU7d55IcxSLwUf+7HIIyYROh9H29r1A== Content-Transfer-Encoding: 8bit X-GMX-UID: FUO5dHouPjl+BApvoDQ2LRU7MTE2NQmZ X-FuHaFi: 0.57999999999999996 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.261 tagged_above=-5 required=5 tests=BAYES_05=-0.5, HK_RANDOM_ENVFROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=0.77, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201009/24 X-Sequence-Number: 34555 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