Search code examples
yugabytedb

Changing index default sharding scheme to range in YugabyteDB


I saw the default sharding scheme for Secondary Indexes is HASH for the first column. (https://docs.yugabyte.com/preview/explore/indexes-constraints/secondary-indexes-ysql/) My DDL is generated mostly via ORM (hibernate: create index IDXname on tbl_name (date_column_name)).

A useful default would be ASC for Secondary Indexes (i.e. where clause containing from and to dates).

Is there a policy or a tool that can be employed in YugabyteDB to set such a default? Or some other way to approach this problem?

Using YugabyteDB (Open source 2.18.3.0-b75)


Solution

  • Since version 2.21 and 2024.1 the default can be set to ASC sharding with

    set yb_use_hash_splitting_by_default=on
    

    at session, user, database, or cluster level