TGViewer
Computer Science and Programming Computer Science and Programming @computer_science_and_programming ยท 140K subscribers
Post #1261 47.7K
๐Ÿฎ๐Ÿฌ ๐—ฆ๐—ค๐—Ÿ ๐—พ๐˜‚๐—ฒ๐—ฟ๐˜† ๐—ผ๐—ฝ๐˜๐—ถ๐—บ๐—ถ๐˜‡๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜๐—ฒ๐—ฐ๐—ต๐—ป๐—ถ๐—พ๐˜‚๐—ฒ๐˜€

Below are the SQL query optimization techniques that I found to be significant, listed in the top 20:

1. Create an index on huge tables (>1.000.000) rows
2. Use EXIST() instead of COUNT() to find an element in the table
3. SELECT fields instead of using SELECT *
4. Avoid Subqueries in WHERE Clause
5. Avoid SELECT DISTINCT where possible
6. Use WHERE Clause instead of HAVING
7. Create joins with INNER JOIN (not WHERE)
8. Use LIMIT to sample query results
9. Use UNION ALL instead of UNION wherever possible
10. Use UNION where instead of WHERE ... or ... query.
11. Run your query during off-peak hours
12. Avoid using OR in join queries
14. Choose GROUP BY over window functions
15. Use derived and temporary tables
16. Drop the index before loading bulk data
16. Use materialized views instead of views
17. Avoid != or <> (not equal) operator
18. Minimize the number of subqueries
19. Use INNER join as little as possible when you can get the same output using LEFT/RIGHT join.
20. Frequently try to use temporary sources to retrieve the same dataset.
  • ๐Ÿ‘ 104
More from @computer_science_and_programming
  1. Oct 8, 2026Dark mode toggles: two states are enough โ€ข Lea Verou (Light, Dark, System). The core argumโ€ฆ
  2. Oct 3, 2026BYD says it will have a solid-state car next year, the earliest date anyone has given BYDโ€ฆ
  3. Oct 1, 2026Introducing G#: A Go-like language for .NET G# is a new open-source, Go-inspired programmiโ€ฆ
  4. Sep 30, 2026Chrome for Developers Chrome 146 introduces three notable features for web developers. Scrโ€ฆ
  5. Sep 26, 2026Introduction to Solon A comprehensive tutorial walks through building a REST API with Soloโ€ฆ
  6. Sep 25, 2026The strangler fig pattern: modernizing without a big-bang rewrite A detailed guide to theโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’