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

Walkthrough has an example that may be inadvisable #14

Open
jjhoo opened this issue Dec 16, 2019 · 3 comments
Open

Walkthrough has an example that may be inadvisable #14

jjhoo opened this issue Dec 16, 2019 · 3 comments

Comments

@jjhoo
Copy link

jjhoo commented Dec 16, 2019

The query

SELECT DISTINCT city 
FROM crime_scene_report 
WHERE LOWER(city) = 'sql city';

has a WHERE condition that may perform poorly generally speaking. If there was an index on crime_scene_report.city it might not be utilized due to LOWER(city), leading to bad performance due to a full table scan.

@JoeGermuska
Copy link
Member

Thanks for your interest in the project! That specific example is given in the context of learning about the existence of UPPER and LOWER functions, so it's hard to know how to teach those to people without running the theoretical risk you identify. Do you have a suggestion?

@Kryptos-FR
Copy link

Adding a comment about that pitfall after the query. Or have a specific optional section at the end of that tutorial about performance considerations, if you feel it is too early to talk about those when UPPER and LOWER are introduced.

@raylu
Copy link

raylu commented Dec 17, 2019

for an exploratory introduction to SQL, I think it's ok to leave out schema structure details like reasoning about query performance

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

4 participants