{question}
How can I use BUCKET_COUNT to reduce memory usage for rowstore tables in SingleStore?
{question}
{answer}
Rowstore tables in SingleStore store both data and indexes entirely in memory. A rowstore table with a HASH index allocates a default number of buckets across partitions, which consumes memory, even if the table remains empty. Buckets are used to distribute data points efficiently for faster lookups.
If you know the table will always remain small, you can reduce memory usage by specifying a lower BUCKET_COUNT value in the hash index definition. However, a low bucket count may negatively impact performance if the table grows significantly.
Below is an example of how to create a table with a hash index using a reduced BUCKET_COUNT:
More information can be found here:
-
BUCKET_COUNTIt is specific to the HASH index type. It controls the bucket count of the hash table. It applies to rowstore hash indexes only and does not affect columnstore hash indexes.
{answer}