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)
You can use hibernates facility to define index column and sort order for this. That would be most portable. https://www.baeldung.com/jpa-indexes
Example: For orm-exmaple’s Product.java
You can add indexed attribute with @Index annotation and put ASC or DESC in the column list
@Entity
@Table(
name = "products",
indexes = @Index(name="idx_product_names", columnList = "productName ASC")
)
public class Product {
It’s not possible to change the default for all indexes in Yugabyte.
You should be able to hook into your migrations framework to change the default though.