Question : I have what I call a ‘Hamlet’ query in the form: select * from stuff a left join […]
Category: Query Performance
How can I get a value of a column to 2 decimal points?
Question : As you can see from the columns, i wanted the output to be 2 decimal place as shown […]
How do I count rows with two properties in one index scan in SQL?
Question : I have a table Units where I have rows ItemId, ItemCreationDate, ItemUnitsCount. ItemId is a primary key and […]
Remove sub-string from WHERE clause
Question : I have a stored procedure that is using the SUBSTRING function in the WHERE clause. SELECT DISTINCT ColumnBB, […]
Performance issue with larger resultsets SQL Server
Question : I currently have a stored procedure in SQL Server where I execute a SELECT statement multiple times based […]
What can be done to further enhance performance of Multiple Join and Aggregate Queries?
Question : I have a typical star schema simulated here, and I am mentioning two queries: first query simply joins […]
Seek and you shall Scan… on partitioned tables
Question : I’ve read these articles in PCMag by Itzik Ben-Gan: Seek and You Shall Scan Part I: When the […]
Optimized date compare in WHERE clause, convert or datediff=0?
Question : In my query I am comparing two dates in the WHERE clause once using CONVERT: CONVERT(day,InsertedOn) = CONVERT(day,GETDATE()) […]
How can i tune below proc either by changing query or adding index
Question : I am having issues with one of the proc running very slow approx an hour: Please pardon as […]
Optimize Query with Derived Table
Question : I have the following query select ps.id, ps.title , IFNULL(s.likes,0) as num_likes , IFNULL(s.comments,0) as num_comments , IFNULL(s.ratings,0) […]