Range query

A range query ( engl.: range query) is a standard database query that locates all records (rows in a database table Relational Database), in which a certain attribute is within a predetermined interval. Range queries are unusual, since it is not known in advance whether and how many entries are returned. Many other queries about after the ten oldest employees or the newest employees of a company can be run more efficiently, since the number of returned entries is bounded above.

Examples

  • All employees who have more than ten years of professional experience.
  • All products whose price is between 10 and 100 euros.

Optimization

With a database index on the corresponding attribute the records we want (scan ) can be determined without a sequential search perform on the entire table. A clustering of the table with respect to the corresponding attribute in the mass memory also allows that only the addresses of the two data sets must be determined, which represent the interval boundaries (via database index ), and then all the relevant records can be read sequentially. By clustering the access time of a hard disk is reduced, for SSDs it hardly matters. Both optimizations are met by a clustered index.

  • Databases

Pictures of Range query

116733
de