DEV Community

Singh Sachina
Singh Sachina

Posted on

Making SQL Queries 100x Faster with One Index

CREATE INDEX IX___NULL
ON ()
WHERE IS NULL;

🔧 Where to put your actual names?
Replace with your table name
Replace with the column you want to select
Replace with the column that contains NULL values

Creating a filtered index on only the rows where a large column is NULL helps the database avoid a full table scan and makes the query 10x–100x faster.

Top comments (0)