Database Design – What is Cover-to-Cover Indexing?

database-designindex

I came across this term reading my lecture notes; I can't find it on the internet.

My notes say the following:

Given a schema R(A,B) and a query of the form "A=a", or "B=b", or
"(A=a AND B=b)". Two indices over "A" and "A,B" provide a
cover-to-cover indexing of the schema.

If the schema contains N attributes, then the binomial (N, N/2) is the
number of indices necessary to provide a cover-to-cover indexing.

Can someone shed some light on this topic? What is cover-to-cover indexing?

Best Answer

John M's link in the comments is perfect, but if you want a quick summary:

Covering indices allow the engine to pull all of the relevant data directly from the values in the indices themselves; in this way, the data pages never have to be loaded and parsed to fulfil the query and build the result set.

Example with index on (A,B):

SELECT B FROM table1 WHERE A=9;

For MySQL (let's say InnoDB), for example, on the B-TREE index at values of 9 for A, we can easily gather all of the values of B for the result set right from these same index nodes we're already reading, use of the pointers to the table data pages are not necessary since we have everything we need to fulfil the query already.