Re: [HACKERS] [POC] A better way to expand hash indexes.
От | Amit Kapila |
---|---|
Тема | Re: [HACKERS] [POC] A better way to expand hash indexes. |
Дата | |
Msg-id | CAA4eK1K6eAEcoTTJh1yDWVD65v7AaavnjHOqEczwq0U1qTX27A@mail.gmail.com обсуждение исходный текст |
Ответ на | [HACKERS] [POC] A better way to expand hash indexes. (Mithun Cy <mithun.cy@enterprisedb.com>) |
Ответы |
Re: [HACKERS] [POC] A better way to expand hash indexes.
|
Список | pgsql-hackers |
On Fri, Feb 17, 2017 at 7:21 PM, Mithun Cy <mithun.cy@enterprisedb.com> wrote: > > To implement such an incremental addition of bucket blocks I have to > increase the size of array hashm_spares in meta page by four times. > Also, mapping methods which map a total number of buckets to a > split-point position of hashm_spares array, need to be changed. These > changes create backward compatibility issues. > How will high and lowmask calculations work in this new strategy? Till now they always work on doubling strategy and I don't see you have changed anything related to that code. Check below places. _hash_metapinit() { .. /* * We initialize the index with N buckets, 0 .. N-1, occupying physical * blocks 1 to N. The first freespace bitmap page is in block N+1. Since * N is a power of 2, we can set the masks this way: */ metap->hashm_maxbucket = metap->hashm_lowmask = num_buckets - 1; metap->hashm_highmask = (num_buckets << 1) - 1; .. } _hash_expandtable() { .. if (new_bucket > metap->hashm_highmask) { /* Starting a new doubling */ metap->hashm_lowmask = metap->hashm_highmask; metap->hashm_highmask = new_bucket | metap->hashm_lowmask; } .. } Till now, we have worked hard for not changing the page format in a backward incompatible way, so it will be better if we could find some way of doing this without changing the meta page format in a backward incompatible way. Have you considered to store some information in shared memory based on which we can decide how much percentage of buckets are allocated in current table half? I think we might be able to construct this information after crash recovery as well. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: