Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-24876] Improves MIN/MAX performance when a function index but the first key is not a function. #4601

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

ctshim
Copy link
Contributor

@ctshim ctshim commented Aug 21, 2023

http://jira.cubrid.org/browse/CBRD-24876

  • If the first key part in the function index is not a function, change the index to be used when obtaining the minimum/maximum value.
drop table if exists t1, t2;
create table t1(col1 int, col2 int );
create table t2  like t1;
insert into t1 select rownum, random() from table({0,1,2,3,4,5,6,7,8,9}) a, table({0,1,2,3,4,5,6,7,8,9}) b, table({0,1,2,3,4,5,6,7,8,9}) c, table({0,1,2,3,4,5,6,7,8,9}) d;
insert into t2 select * from t1;

create index idx on t1(col1, abs(col2));
create index idx on t2(col1 desc, abs(col2) desc);

-- In the execution result below, you can see that the number of fetches is reduced.
set trace on;
select /*+ recompile */ min(col1), max(col1) from t1;  
show trace;
select /*+ recompile */ min(col1), max(col1) from t2;  
show trace;

@ctshim ctshim self-assigned this Aug 21, 2023
@ctshim ctshim changed the title [CBRD-24876] Improves MIN/MAX performance when the first part of the function index is not a function [CBRD-24876] Improves MIN/MAX performance when a function index but the first key is not a function. Aug 21, 2023
@ctshim ctshim merged commit 1aec308 into CUBRID:develop Aug 23, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants