pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Klemme <shortcutter@googlemail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Index Scan Backward Slow
Date: Sat, 02 May 2015 10:48:40 +0200
Message-ID: <mi2319$4ed$1@ger.gmane.org> (raw)
In-Reply-To: <CAKmpXCfsdTHHAkhuc4Vd54M=-OQYG=r2ax-UhqoF9DbbrpF=OQ@mail.gmail.com>
References: <CAKmpXCf9eBoP2pW9MUvYgjj+m0wTLiAoGW2LHZkVJp5EOs-Lkw@mail.gmail.com>
	<ED80026F-9A71-4838-8A5F-8B92878FB3DB@gmail.com>
	<CAKmpXCfsdTHHAkhuc4Vd54M=-OQYG=r2ax-UhqoF9DbbrpF=OQ@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 01.05.2015 13:06, David Osborne wrote:
> Simple... that did it... thanks!
>
> dev=> create index on table(code,row_id);
> CREATE INDEX
> Time: 38088.482 ms
> dev=> explain (analyse,buffers)  select row_id as last_row_id from table
> where code='XX' order by row_id desc limit 1;

Just out of curiosity: Is there a particular reason why you do not use

select max(row_id) as last_row_id
from table
where code='XX'

?

Kind regards

	robert




-- 
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 (4+ messages)

Message-ID: <mi2319$4ed$1@ger.gmane.org>
Permalink:  ../mi2319$4ed$1@ger.gmane.org/
Also on:    postgresql.org/message-id/mi2319$4ed$1@ger.gmane.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: shortcutter@googlemail.com
  Subject: Re: Index Scan Backward Slow
  In-Reply-To: <mi2319$4ed$1@ger.gmane.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