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

sql: analyze where conditions to avoid full table scans in SELECT #1625

Closed
petermattis opened this issue Jul 2, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@petermattis
Copy link
Collaborator

Processing of SELECT statements currently always performs a full table scan. We need to analyze the where condition to determine restrictions that allow for partial scans or individual row lookups. The analysis would look for restrictions on a prefix of the primary key (the only supported index at the moment). Retrieval of individual rows will also have to take into account the columns needed by the select expression.

@veteranlu
Copy link
Contributor

Mysql has condition pushdown and index condition pushdown optimization, these avoid reading full rows corresponding to all tuples that do not match the condition.

@petermattis
Copy link
Collaborator Author

@veteranlu The condition pushdown optimization is a bit different from what this issue is in reference to which is basic support for using indexes to avoid full table scans. I'll have to read those docs further, but it sounds similar to filtering functionality I'd like to add the basic KV ScanRequest. Essentially, I want to add an optional `filter' expression that can restrict what key/value pairs are returned from a scan.

@petermattis petermattis changed the title sql/query: analyze where conditions to avoid full table scans in SELECT sql: analyze where conditions to avoid full table scans in SELECT Jul 23, 2015
@petermattis
Copy link
Collaborator Author

The SQLite documentation on their query planner gives a decent overview of when indexes can be used: https://www.sqlite.org/queryplanner.html

@petermattis petermattis added this to the v0.1 (Beta) milestone Aug 14, 2015
@tbg tbg added the SQL label Aug 15, 2015
@jess-edwards jess-edwards mentioned this issue Aug 17, 2015
78 tasks
@petermattis petermattis self-assigned this Aug 18, 2015
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

No branches or pull requests

3 participants