Question : I have a query that calculates row_Number(). The table has a clustered index on the same columns (and […]
Category: Database Optimization
Mysql GROUP BY is really slow on a simple view
Question : I have these tables. CREATE TABLE `movements` ( `movementId` mediumint(8) UNSIGNED NOT NULL, `movementType` tinyint(3) UNSIGNED NOT NULL, […]
Basic PARTITION question in MySQL
Question : Say I have an application using MySQL and at some point decide that implementing Partitions on certain tables […]
Stored Procedure with HINT “WITH RECOMPILE” loses performance, solved with DBCC FLUSHPROCINDB [duplicate]
Question : This question already has answers here: When a previously-fast SQL query starts running slow, where do I look […]
How to prevent duplicate or similar data from getting processed?
Question : I have a stored procedure which calculates the distance between 2 coordinate points: CREATE PROC loc.CalcDistanceByPostalCode ( @From […]
Help creating this query
Question : I’d like to integrate the following query: SELECT parent.id , COUNT(child.id) AS child_count FROM messages parent INNER JOIN […]
Postgres: count(*) vs count(id)
Question : I saw in the documentation the difference between count(*) and count(pk). I had been using count(pk) (where pk […]
SQL Server Optimization/Configuration for Inflexible Application
Question : I’m responsible for overseeing an application which uses SQL Server as its backend storage solution. Unfortunately, the application […]
Horribly performing query, how to fix
Question : select user_id, count(id) as unread_count from notifications where is_read = false and user_id in(select(unnest(‘{200 user IDs}’ :: bigint[]))) […]
In Postgresql, can I create a column of a one-dimension array type with foreign key constraint? If not, how to simulate it?
Question : In essence I have to design todo table, and an item table. I need to preserve item order, […]