Correct usage of INT PRIMARY KEY with USING HASH WITH BUCKET_COUNT?

Hello, some primary key questions.

I have a requirement of needing to loosely paginate products based on insert sequence.

  1. If I were to hash the Primary Key, is this the correct syntax? create table "products" ("id" int default unique_rowid(), "name" string, primary key (id) USING HASH WITH BUCKET_COUNT = 8);
  2. Documentation of USING HASH WITH BUCKET_COUNT warns it is an experimental feature. Is there a chance of deprecation in the near future?
  3. Am I better off with a UUID Primary Key + hash indexed timestamp instead? Pros/Cons?

Is there some alternative solution Iā€™m not considering, but should? Thanks!

Hello @gnat. Your syntax for using a hash-shareded index looks correct to me (just make sure that you enable the experimental_enable_hash_sharded_indexes session variable first). Hash-sharded indexes are an experimental feature for v21.1, but I am confident that we have no plans for deprecation.

1 Like

Great. Any commentary on point #3?

Just wanted to add this very recent video on the subject for future searchers.