Jim C. Nasby wrote:
> Yeah, my assumption has been that the only way to tell the difference
> would be by timing, but I don't know how practical that is. Since
> gettime() or whatever EXPLAIN ANALYZE uses is apparently very expensive,
> perhaps there's some other alternative. Perhapse the timing info in
> getrusage would work for this. Another idea is setting an alarm for a
> fairly short period before making the IO request. If the request comes
> back before the alarm fires, the data must have been in the OS cache.
>
> Another thought is that any IO request that goes to disk would most
> likely put the process requesting the IO to sleep, but a request being
> served out of cache might not do that. Perhaps there's some way to
> recognize that.
>
> Or maybe a better track would be to develop a patch for as many OSes as
> possible that would tell the caller if an IO request came out of cache
> or not.
Or give up, which seems the most fruitful approach.
-- Bruce Momjian http://candle.pha.pa.us EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +