Re: Cache relation sizes?
От | Andres Freund |
---|---|
Тема | Re: Cache relation sizes? |
Дата | |
Msg-id | 20181106224606.7z6vqmvcrcfzqv6e@alap3.anarazel.de обсуждение исходный текст |
Ответ на | Cache relation sizes? (Thomas Munro <thomas.munro@enterprisedb.com>) |
Ответы |
Re: Cache relation sizes?
|
Список | pgsql-hackers |
Hi, On 2018-11-07 11:40:22 +1300, Thomas Munro wrote: > PostgreSQL likes to probe the size of relations with lseek(SEEK_END) a > lot. For example, a fully prewarmed pgbench -S transaction consists > of recvfrom(), lseek(SEEK_END), lseek(SEEK_END), sendto(). I think > lseek() is probably about as cheap as a syscall can be so I doubt it > really costs us much, but it's still a context switch and it stands > out when tracing syscalls, especially now that all the lseek(SEEK_SET) > calls are gone (commit c24dcd0cfd). I'd really really like to see some benchmarking before embarking on a more complex scheme. I aesthetically dislike those lseeks, but ... > If we had a different kind of buffer mapping system of the kind that > Andres has described, there might be a place in shared memory that > could track the size of the relation. Even if we could do that, I > wonder if it would still be better to do a kind of per-backend > lock-free caching, like this: Note that the reason for introducing that isn't primarily motivated by getting rid of the size determining lseeks, but reducing the locking for extending *and* truncating relations. Greetings, Andres Freund
В списке pgsql-hackers по дате отправления: