Re: Hash partitioning, what function is used to compute the hash?

Поиск
Список
Период
Сортировка
Искать
От
Laurenz Albe
Тема
Re: Hash partitioning, what function is used to compute the hash?
Дата
в 16:28:16
Msg-id
6b2c633b1a8e5479bcaf1e9c25a901884af1bffd.camel@cybertec.at
Ответ на
Список
Дерево обсуждения
Hash partitioning, what function is used to compute the hash? Dennis Ryan <dennisr1963@outlook.com>
Re: Hash partitioning, what function is used to compute the hash? Laurenz Albe <laurenz.albe@cybertec.at>
Re: Hash partitioning, what function is used to compute the hash? Michael Lewis <mlewis@entrata.com>
Re: Hash partitioning, what function is used to compute the hash? Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Hash partitioning, what function is used to compute the hash? Michael Lewis <mlewis@entrata.com>
On Mon, 2020-05-11 at 04:33 +0000, Dennis Ryan wrote:
> Regarding hash partitioning, what is the function/algorithm that is used to compute the hash for the partition key?  I need to write a query like
> 
> “SELECT unknown_partition_hash_function(id) AS hash_value, COUNT(id) AS number_of_records
> FROM existing_table
> GROUP BY 1”

To find the function that PostgreSQL uses to hash a data type,
try something like

SELECT amp.amproc,
       amp.amproclefttype::regtype
FROM pg_amproc AS amp
   JOIN pg_opfamily AS opf ON amp.amprocfamily = opf.oid
   JOIN pg_am ON opf.opfmethod = pg_am.oid
WHERE pg_am.amname = 'hash'
  AND amp.amprocnum = 1;

Yours,
Laurenz Albe
-- 
+43-670-6056265
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com



В списке pgsql-general по дате отправления
От: Matthias Apitz
Дата:
От: Peter Devoy
Дата:
FAQ