From: | Boszormenyi Zoltan <zb(at)cybertec(dot)at> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us> |
Subject: | Re: ECPG FETCH readahead |
Date: | 2012-04-16 17:18:07 |
Message-ID: | 4F8C544F.4080708@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2012-04-16 18:04 keltezéssel, Michael Meskes írta:
> On Mon, Apr 16, 2012 at 06:24:57AM +0200, Boszormenyi Zoltan wrote:
>> Yes, just like when the readahead window set to 256, FETCH 1024
>> will iterate through 4 windows or FETCH 64 iterates through the
>> same window 4 times. This is the idea behind the "readahead window".
> Really? It's definitely not the idea behind FETCH 1024. Using the same window 4
> times for FETCH 64 is the idea though, I agree.
OK. I would like to stretch your agreement a little. :-)
Can we state that caching means that if the cache should serve
the incoming request(s) until the request spills out of it?
If your answer to the above is "yes", then please consider this case:
- readahead window is 256 (via ECPGFETCHSZ)
- FETCH 64 was executed twice, so you are in the middle of the cache
- FETCH 1024 is requested
So, if I understand you correctly, you expect this scenario:
- set a "one-time" readahead window size ( N - # of rows that can be served
= 1024 - 128 = 768) so the next FETCH by the runtime will fullfill
this request fully
- serve the request's first 128 rows from the current cache
- for the 129th row, FETCH 768 will be executed
- all subsequent requests use the old readahead size
>> How about allowing the readahead window to be resized for the
>> non-decorated case if the runtime encounters FETCH N and N is
>> greater than the previous window?
> To be resized by what?
By the new FETCH request. Instead of the above, I imagined this:
- the runtime notices that the new request is larger than the current
readahead window size, modifies the readahead window size upwards,
so the next FETCH will use it
- serve the request's first 128 rows from the current cache
- for the 129th row, FETCH 1024 will be executed and the remaining
768 rows will be served from the new cache
- all subsequent requests use the new readahead size, 1024
> IMO a FETCH N should always be a FETCH N, no matter
> what
This part of your statement contradicts with caching. :-)
> , i.e. if the readahead window is larger, use it, but even if it's smaller
> we should still fetch N at the same time.
So, there can be occasional one-time larger requests but
smaller ones should apply the set window size, right?
Best regards,
Zoltán Böszörményi
--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig& Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2012-04-16 17:23:03 | Re: [BUG] Checkpointer on hot standby runs without looking checkpoint_segments |
Previous Message | Alex | 2012-04-16 17:15:10 | Re: Bug tracker tool we need |