HashTable KeySize

From: Natarajan R <nataraj3098(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: HashTable KeySize
Date: 2019-10-04 11:36:47
Message-ID: CAPqxBt7jJ8JMqmUoSJm7TCfBAa-KAgpap6+kUAE3Pr6i+Ec6ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

typedef struct HashTableKey
{
Oid dbId; // 4 bytes
int64 productid; // 8 bytes
}HashTableKey; (total size - 12 bytes)

typedef struct HashTableEntry
{
HashTableKey key;
ProductInfo *pdt;
}HashTableEntry;

HASHCTL hashInfo;
hashInfo.keysize = sizeof(HashTableKey);
hashInfo.entrysize = sizeof(HashTableEntry);
SampleHashTable = ShmemInitHash("productid vs product struct HashTable",
size, size, &hashInfo, HASH_ELEM | HASH_SHARED_MEM | HASH_BLOBS);

while printing keysize: elog(LOG,"Keysize = %d",sizeof(HashTableKey));

I am getting Keysize = 16, How? what should i need to do inorder to have
keysize = 12

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2019-10-04 11:53:40 Re: pg_upgrade fails with non-standard ACL
Previous Message Asif Rehman 2019-10-04 11:01:55 Re: WIP/PoC for parallel backup