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

Feat: Support TopK on Order By ... Limit ... #178

Open
KKould opened this issue Mar 25, 2024 · 3 comments
Open

Feat: Support TopK on Order By ... Limit ... #178

KKould opened this issue Mar 25, 2024 · 3 comments
Labels

Comments

@KKould
Copy link
Member

KKould commented Mar 25, 2024

Feature Request

When OrderBy .. Limit .. exists, the TopK operator will be used

Tips: TopK should also use index

@KKould KKould added the perf label Mar 25, 2024
@crwen
Copy link
Member

crwen commented Mar 29, 2024

It seems that IndexScan will not be used, because the the calculated cost is None(StatisticsMeta file is not found, only Analyze can generate these files, but Analyze may have something wrong)

Analyze table t;
ERROR:  there are more buckets: 100 than elements: 0

@KKould
Copy link
Member Author

KKould commented Mar 29, 2024

It seems that IndexScan will not be used, because the the calculated cost is None(StatisticsMeta file is not found, only Analyze can generate these files, but Analyze may have something wrong)

Analyze table t;
ERROR:  there are more buckets: 100 than elements: 0

@crwen

Index arranges data in ascending order, so when OrderBy...ASC, is it possible to remove the Order Operator and convert SeqScan to IndexScan (it cannot be executed if IndexScan has already used other indexes)

#187 (comment)

Tips: Analyze Table can only be created when the amount of data is greater than 100. Maybe I need to make the information more user-friendly. If you want to use alert table, you can execute benchmark and the internal data will have an index.

@KKould
Copy link
Member Author

KKould commented Mar 29, 2024

Tips: IndexScan only makes sense based on large amounts of data. if not, there is not much difference with SeqScan. At the same time, Index data is arranged in ascending order. You can refer to the test cases here to understand the execution of index.

https://github.com/KipData/FnckSQL/blob/main/tests/slt/where_by_index.slt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants