Skip to content

RFC for select from index.#2046

Merged
petermattis merged 4 commits intomasterfrom
pmattis/sql-select-from-index
Aug 11, 2015
Merged

RFC for select from index.#2046
petermattis merged 4 commits intomasterfrom
pmattis/sql-select-from-index

Conversation

@petermattis
Copy link
Copy Markdown
Collaborator

No description provided.

@petermattis petermattis force-pushed the pmattis/sql-select-from-index branch from a48f4db to 0dd0090 Compare August 11, 2015 02:23
@petermattis petermattis force-pushed the pmattis/sql-select-from-index branch from 0dd0090 to d75d68d Compare August 11, 2015 02:24
Comment thread docs/RFCS/select_from_index.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strikes me as a bit awkward that with that notation, you have to guess whether a.b is table.index or database.table.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it might be wiser to use syntax like table@index or table:index.

@bdarnell
Copy link
Copy Markdown
Contributor

Existing databases have syntax for specifying an index hint, and existing ORMs have support for sending these hints with various syntaxes (http://docs.sqlalchemy.org/en/rel_1_0/core/selectable.html#sqlalchemy.sql.expression.Select.with_hint). It doesn't look like any of these modify the table expression, so it might be more accessible to use a separate clause instead of encoding this in the table name.

@petermattis
Copy link
Copy Markdown
Collaborator Author

@bdarnell I'm aware of the index hints syntax. This is a bit more forceful than that. It's a bit strange to me how SQL goes out of its way to make indexes completely optional and yet if they are not set up or used correctly your application may not run because of horrific performance. I think @tschottdorf's suggestion of requiring an index for specific parts of the where-clause is interesting (though I'd adjust the syntax somewhat).

Comment thread docs/RFCS/select_from_index.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something really doesn't make sense in this sentence.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Fixed.

@spencerkimball
Copy link
Copy Markdown
Member

LGTM. Does our former employer's SQL use anything similar?

@tbg
Copy link
Copy Markdown
Member

tbg commented Aug 11, 2015

LGTM, with the table@index syntax and keeping in mind during testing usage that the semantics may update later.

Using `:` leads to shift/reduce conflicts.

Address feedback.
@bdarnell
Copy link
Copy Markdown
Contributor

LGTM

petermattis added a commit that referenced this pull request Aug 11, 2015
@petermattis petermattis merged commit 8c51083 into master Aug 11, 2015
@petermattis petermattis deleted the pmattis/sql-select-from-index branch August 11, 2015 17:21
@petermattis petermattis removed the PTAL label Aug 11, 2015
petermattis added a commit that referenced this pull request Aug 11, 2015
Added support for "SELECT * FROM table@index". This is an extension
which allows us to more explicitly test our index scanning. The index
must exist within the table and the only columns accessible are those
the index is defined on.

See #2046.
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