- Create an index on very large tables (>1.000.000) rows
- Use EXIST() instead of COUNT() to find an element in the table
- SELECT fields instead of using SELECT *
- Avoid Subqueries in WHERE Clause
- Avoid SELECT DISTINCT where possible
- Use WHERE Clause instead of HAVING
- Create joins with INNER JOIN (not WHERE)
- Use LIMIT to sample query results
- Use UNION ALL instead of UNION wherever possible
- Use UNION where instead of WHERE ... or ... query.
- Run your query during off-peak hours
- Avoid using OR in join queries
- Choose GROUP BY over window functions
- Use derived and temporary tables
- Drop the index before loading bulk data
- Use materialized views instead of views
- Avoid != or <> (not equal) operator
- Minimize the number of subqueries
- Try to use INNER join as little as possible when you can get the same output using LEFT/RIGHT join.
-
Notifications
You must be signed in to change notification settings - Fork 0
DooPhiLong/Optimize-sql-statement
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published