Re: Huge difference between ASC and DESC ordering

From: twoflower <standa(dot)kurik(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Huge difference between ASC and DESC ordering
Date: 2017-03-06 16:46:32
Message-ID: 1488818792254-5947737.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thank you Jeff.

There are 7 million rows satisfying fk_id_client = 20045. There is an index
on fk_id_client, now I added a composite (fk_id_client, id) index but that
did not help.

I see the point of what you are saying, but still don't understand how these
two situations (*asc* vs. *desc*) are not symmetrical. I mean, there /is/ an
ascending index on *JOB_MEMORY.id*, so why does it matter which end I am
picking the data from?

The thing is, even when I force Postgres to use the ascending index on *id*,
it's still orders of magnitude slower than the *desc* version (even when
that one goes through the index backwards).

--
View this message in context: http://www.postgresql-archive.org/Huge-difference-between-ASC-and-DESC-ordering-tp5947712p5947737.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2017-03-06 17:11:30 Re: Huge difference between ASC and DESC ordering
Previous Message Jeff Janes 2017-03-06 16:19:31 Re: Huge difference between ASC and DESC ordering