Re: mdnblocks() sabotages error checking in _mdfd_getseg()

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: mdnblocks() sabotages error checking in _mdfd_getseg()
Дата
Msg-id CA+TgmoYzBBPqzP5X20htCG7Op8v9m=G4f0R2ObkDcXJRz44CuA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: mdnblocks() sabotages error checking in _mdfd_getseg()  (Andres Freund <andres@anarazel.de>)
Ответы Re: mdnblocks() sabotages error checking in _mdfd_getseg()  (Greg Stark <stark@mit.edu>)
Re: mdnblocks() sabotages error checking in _mdfd_getseg()  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
On Thu, Dec 10, 2015 at 11:36 AM, Andres Freund <andres@anarazel.de> wrote:
>> In fact, having no way to get the relation length other than scanning
>> 1000 files doesn't seem like an especially good choice even if we used
>> a better data structure.  Putting a header page in the heap would make
>> getting the length of a relation O(1) instead of O(segments), and for
>> a bonus, we'd be able to reliably detect it if a relation file
>> disappeared out from under us.  That's a difficult project and
>> definitely not my top priority, but this code is old and crufty all
>> the same.)
>
> The md layer doesn't really know whether it's dealing with an index, or
> with an index, or ... So handling this via a metapage doesn't seem
> particularly straightforward.

It's not straightforward, but I don't think that's the reason.  What
we could do is look at the call sites that use
RelationGetNumberOfBlocks() and change some of them to get the
information some other way instead.  I believe get_relation_info() and
initscan() are the primary culprits, accounting for some enormous
percentage of the system calls we do on a read-only pgbench workload.
Those functions certainly know enough to consult a metapage if we had
such a thing.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Patch: ResourceOwner optimization for tables with many partitions
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Error with index on unlogged table