Uploaded on Oct 17, 2023
5 Tips to write speedy SQL Queries 1.Create Small Batches of Data for Deletion and Updation 2. Use CASE instead of UPDATE 3. Avoid Negative Searches 4. Use the Exact Number of Columns 5. Use Fewer Cursors
Grey Blue Corporate Recruitment and Selection Policy Presentation
5 Tips to write
speedy SQL
Queries
1.Create Small Batches of Data for Deletion and Updation
Use smaller data batches for updates and deletions instead of large ones.
This lessens data loss risk during rollbacks and improves concurrency,
allowing uninterrupted work on unaffected data while changes are made.
2. Use CASE instead of UPDATE
UPDATE statements in SQL involve lengthier table writing due to logging,
whereas inline CASE statements decide preferred outcomes before writing.
This pre-determined decision-making enhances speed by avoiding
unnecessary writes, optimizing the process.
3. Avoid Negative
Searches
When you search for things that don't exist in your database, it can make
things slow down a lot. To fix this, you can make the searches work faster
by changing how you search, especially when you're dealing with a lot of
data.
4. Use the Exact Number of Columns
When you create a select statement, make sure you're asking for the right
amount of information for the number of things you're looking at. This
helps your search work faster and makes your tasks speed up.
5. Use Fewer Cursors
Cursors can cause a lot of issues, especially with how fast things happen.
They can also lead to things getting stuck and stopping other actions from
working. This can mess up how things happen at the same time, making
everything slow down.
Follow us on
social media
for more!
Comments