Index Covering Query
Index Covering Query is a SQL statement in the Indexes category. When an index contains all the columns a query needs, the database reads only the index (not the table). This is the fastest access method. The syntax is -- A covering index contains all columns needed by a query, eliminating table access entirely.. It returns covering index optimization. A typical example: CREATE INDEX idx_covering ON employees (department_id) INCLUDE (name, salary); -- Query only needs columns from the index: SELECT name, salary FROM employees WHERE department_id = 5; -- SQL Server: Index Only Scan (covering) -- PostgreSQL: Index Only Scan -- MySQL: Using index (in Extra column) -- The index contains: -- Key: department_id (for searching) -- Non-key: name, salary (for covering) -- Without covering index: -- 1. Find matching department_id in⦠A close relative is CREATE INDEX, which creates an index on one or more columns to speed up query performance.