# What are 'Range' and 'Radius' queries and what is the difference between them?

While searching for easy and effective tools to improve performance of Data fetching for our application, we bumped into "Redis".

In documentation of redis, there is following specific mention of these two types or categories of queries:

It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries...

This was first time in area of database and data structures, I have read such thing. I dug out internet to know more, but found nothing useful.

What exactly are Range and Radius queries? What is the difference between the two? Any explanation with example will be useful.

## 1 Answer

`Range` stands for one-dimensional distance while `radius` is standing for two-dimensional one.

Let's the data is the timestamp. It is one-dimensional and you can define part of data "in range" or `timestamp BETWEEN a AND b`. If your data represents the plane of points x:y then you can define part of them as "points closer than radius Z to the given point" or `(x-x1)^2 + (y-y1)^2 < Z^2`.

• is Radius for GEO locations only? – Josefine Jul 30 '17 at 5:51
• If you can represent your type/class as cartesian plane then you can use `radius` for your purposes. – Kondybas Jul 30 '17 at 12:49
• Oh okay, this means there must be some terminology for three dimensional space? – Karan Desai Aug 1 '17 at 4:14
• Both circle and sphere has radius that equals to the root of sum of squares of projections. So terminology is exactly the same. – Kondybas Aug 1 '17 at 7:57