Skip to content

Query the values of IP addresses after geohash encoding

Use the ip_to_geo function to obtain the latitude and longitude of the current IP address and then use the geohash method to obtain the encoded value. The value of tag:client_ip contains the special character colon (😃 and must be enclosed in double quotation marks ("). The results are displayed in a table. If the queried data is written before an index is created, null is returned.

SQL
* |
select
  geohash(ip_to_geo("__tag__:__client_ip__")) as hash
group by
  hash

SQLSample query result:

样例图片