Skip to content

Commit

Permalink
sql: set hash-sharded index column type to INT8
Browse files Browse the repository at this point in the history
Shard columns of hash-sharded indexes are computed columns with an
expression in the form `mod(fnv32(crdb_internal.datums_to_bytes(...)))`.
The `mod()` builtin returns a value of type `INT8`, while the shard
column's type was previously `INT4`. Because these types did not match,
`mod` expressions were wrapped in the assignment cast function,
`crdb_internal.assignment_cast`, in mutation query plans.

This commit changes the type of newly created shard columns to `INT8`,
eliminating the need for an assignment cast. Because all integers are
encoded as varints in keys and values, this will not increase the amount
of space on disk required for these columns.

Release note (sql change): The type of shard columns created for
hash-sharded indexes have changed from `INT4` to `INT8`. This should
have no effect on behavior or performance.
  • Loading branch information
mgartner committed Feb 23, 2022
1 parent 715520b commit 4722ea9
Show file tree
Hide file tree
Showing 4 changed files with 506 additions and 506 deletions.
Loading

0 comments on commit 4722ea9

Please sign in to comment.