pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Claudio Freire <klaussfreire@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert DiFalco <robert.difalco@gmail.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Efficiently query for the most recent record for a given user
Date: Wed, 7 Aug 2013 15:05:48 -0400
Message-ID: <20130807190548.GK10718@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <CAGTBQpZUUOqF6adjmt62Hmc_OYRo3meaoNY9tn93sULRoovO_w@mail.gmail.com>
References: <CAAXGW-yF4urbcPHRj2DwcmkzE66DeJfKQQ+sTmZX-BD_FXKecw@mail.gmail.com>
	<CAGTBQpY5pDZBgpo+huLzUpi6zve69V7KKWUVeLaSBpr6ZvOLwQ@mail.gmail.com>
	<9813.1375900452@sss.pgh.pa.us>
	<CAGTBQpZUUOqF6adjmt62Hmc_OYRo3meaoNY9tn93sULRoovO_w@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Claudio Freire escribió:
> On Wed, Aug 7, 2013 at 3:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> > Note that there's no particular need to specify "desc" in the index
> > definition.  This same index can support searches in either direction
> > on the "called" column.
> 
> Yeah, but it's faster if it's in the same direction, because the
> kernel read-ahead code detects sequential reads, whereas it doesn't
> when it goes backwards. The difference can be up to a factor of 10 for
> long index scans.

That might be true when an index is new, but as it grows, the leaf pages
are not going to be sequential anymore.  And this doesn't much apply for
an equality lookup anyway, does it?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (10+ messages)  latest in thread

Message-ID: <20130807190548.GK10718@eldon.alvh.no-ip.org>
Permalink:  ../20130807190548.GK10718@eldon.alvh.no-ip.org/
Also on:    postgresql.org/message-id/20130807190548.GK10718@eldon.alvh.no-ip.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: alvherre@2ndquadrant.com, klaussfreire@gmail.com, tgl@sss.pgh.pa.us, robert.difalco@gmail.com
  Subject: Re: Efficiently query for the most recent record for a given user
  In-Reply-To: <20130807190548.GK10718@eldon.alvh.no-ip.org>
  References: <CAAXGW-yF4urbcPHRj2DwcmkzE66DeJfKQQ+sTmZX-BD_FXKecw@mail.gmail.com> <CAGTBQpY5pDZBgpo+huLzUpi6zve69V7KKWUVeLaSBpr6ZvOLwQ@mail.gmail.com> <9813.1375900452@sss.pgh.pa.us> <CAGTBQpZUUOqF6adjmt62Hmc_OYRo3meaoNY9tn93sULRoovO_w@mail.gmail.com> <20130807190548.GK10718@eldon.alvh.no-ip.org>

* 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