Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.

Поиск
Список
Период
Сортировка
От Ashutosh Sharma
Тема Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.
Дата
Msg-id CAE9k0PkYu==NvCitEQ0yJbifLq7AydqZ8+RGPFY8mMtrJCq7ag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.  (Kuntal Ghosh <kuntalghosh.2007@gmail.com>)
Ответы Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.  (Kuntal Ghosh <kuntalghosh.2007@gmail.com>)
Список pgsql-hackers
> I've looked at the patch. It looks good. However, I was wondering why
> an exclusive lock for extension is necessary for reading the number
> blocks in this case. Please refer to the following code.
>
> +       /* Get the current relation length */
> +       LockRelationForExtension(rel, ExclusiveLock);
> +       nblocks = RelationGetNumberOfBlocks(rel);
> +       UnlockRelationForExtension(rel, ExclusiveLock);
>
> Apart from this, I've nothing else to add.


Actually in my case I may not need to acquire ExclusiveLock just to
get the number of pages in a relation. Infact I have already opened a
relation using
'AccessShareLock' which should be enough to read a table length.
Thanks for putting this point. I have corrected it in the attached v5
patch. I think
in 'pgstat_index()' currently LockRelationForExtension(rel,
ExclusiveLock); is being used just to read a table length which I feel
is not required. You may raise this point in the community in a
separete mail thread if you agree with it. Also, I guess
LockRelationForExtension() is used when trying to add a new page in an
existing relation so not sure if it would be right to call it from
contrib modules like pgstattuple where we are just trying to read the
tables.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: [HACKERS] Faster methods for getting SPI results (460% improvement)
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] [PATCH] Rename pg_switch_xlog to pg_switch_wal