hash as an search key and hash collision

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: hash as an search key and hash collision
Date: 2020-06-19 08:24:01
Message-ID: CAKU4AWrhg3=fNnzc+wzO-0Or7Ot3hiKUu8N4draJ=6ZbqWJbBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I want to maintain an internal table which the primary key is sql_text and
planstmt::text, it is efficient since it both may be very long. So a
general
idea is to use sql_hash_value and plan_hash_value. Then we have to
handle the hash collision case. However I checked the codes both in
sr_plans[1]
and pg_stat_statements[2], both of them didn't handle such cases, IIUC. so
how can I understand this situation?

[1]
https://github.com/postgrespro/sr_plan/blob/41d96bf136ec072dac77dddf8d9765bba39190ff/sr_plan.c#L383
[2]
https://github.com/postgres/postgres/blob/master/contrib/pg_stat_statements/pg_stat_statements.c#L154

--
Best Regards
Andy Fan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-06-19 08:34:01 Re: min_safe_lsn column in pg_replication_slots view
Previous Message Fujii Masao 2020-06-19 08:23:24 Re: Review for GetWALAvailability()