Re: SQL select query becomes slow when using limit (with no offset)

From: Devin Ben-Hur <dbenhur(at)whitepages(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Scott Carey <scott(at)richrelevance(dot)com>, Kees van Dieren <keesvandieren(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: SQL select query becomes slow when using limit (with no offset)
Date: 2009-08-10 18:41:53
Message-ID: 4A8069F1.9090108@whitepages.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Robert Haas wrote:
> On Mon, Aug 10, 2009 at 11:19 AM, Kevin Grittner<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
>> (2) Somehow use effective_cache_size in combination with some sort of
>> current activity metrics to dynamically adjust random access costs.
>> (I know, that one's total hand-waving, but it seems to have some
>> possibility of better modeling reality than what we currently do.)

I was disappointed when I learned that effective_cache_size doesn't get
generally used to predict the likelihood of a buffer fetch requiring
physical io.

> Yeah, I gave a lightning talk on this at PGcon, but I haven't had time
> to do anything with it. There are a couple of problems. One is that
> you have to have a source for your current activity metrics. Since a
> lot of the pages of interest will be in the OS buffer pool rather than
> PG shared buffers, there's no easy way to handle this

While there are portability concerns, mmap + mincore works across BSD,
Linux, Solaris and will return a vector of file pages in the OS buffer
pool. So it's certainly possible that on supported systems, an activity
monitor can have direct knowledge of OS caching effectiveness on a per
relation/index basis.

--
-Devin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2009-08-11 21:14:12 Why is vacuum_freeze_min_age 100m?
Previous Message Robert Haas 2009-08-10 16:21:29 Re: SQL select query becomes slow when using limit (with no offset)