Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite scope_identity on some index lookups (yugabyte#94)
Currently, a problem arises when using scope_identity to lookup on an index of identities. Babelfish implemented identity columns using INT sequences, but scope_identity returns a numeric type. Numeric has higher precedence than int, so the index column is implicitly cast to a numeric. However, this means queries that should use an index lookup instead use a sequential scan, significantly degrading performance. With this change, if a call to scope_identity or babelfish_get_last_identity_numeric (used with @@identity) is found in a where clause compared to an integer, the function is replaced with babelfish_get_last_identity, which returns an int so the index is used. Task: BABEL-3384 Signed-off-by: Walt Boettge <[email protected]>
- Loading branch information