Junior — Middle
What does a high degree of selectivity in database queries mean?
sobes.tech AI
Answer from AI
High selectivity in database queries means that the query filters data very efficiently, returning a small subset of records from the total.
For example, if a table has a million records and a query with a WHERE condition returns only 10 records, then the selectivity is high (10/1,000,000 = 0.001%).
High selectivity is important for query optimization because it allows the database to use indexes and quickly find the needed data, reducing load and execution time.
Low selectivity — when a query returns a large part of the table — usually leads to a full table scan and decreased performance.