Geomesa:在 Redis 中使用统计信息

Geomesa: Using statistics in redis

我尝试将 geomesa 与 redis 一起使用。还以为redis默认开启了geomesa统计

我的redis geomesa数据库:

./geomesa-redis describe-schema -u localhost:6379 -c geomesa -f SignalBuilder                                                                                   
INFO  Describing attributes of feature 'SignalBuilder'
geo           | Point   (Spatio-temporally indexed) (Spatially indexed)
time          | Date    (Spatio-temporally indexed) (Attribute indexed)
cam           | String  (Attribute indexed) (Attribute indexed)
imei          | String  
dir           | Double  
alt           | Double  
vlc           | Double  
sl            | Integer 
ds            | Integer 
dir_y         | Double  
poi_azimuth_x | Double  
poi_azimuth_y | Double  

User data:
  geomesa.attr.splits     | 0
  geomesa.feature.expiry  | time(30 days)
  geomesa.id.splits       | 0
  geomesa.index.dtg       | time
  geomesa.indices         | z3:7:3:geo:time,z2:5:3:geo,attr:8:3:time,attr:8:3:cam,attr:8:3:cam:time
  geomesa.stats.enable    | true
  geomesa.table.partition | time
  geomesa.z.splits        | 0
  geomesa.z3.interval     | week

来自文档:https://www.geomesa.org/documentation/stable/user/datastores/query_planning.html#stats-collected

Stat generation can be enabled or disabled through the simple feature type user data using the key geomesa.stats.enable

Cached statistics, and thus cost-based query planning, are currently only implemented for the Accumulo and Redis data stores.

*Total count, *Min/max (bounds) for the default geometry, *default date and any indexed attributes, *Histograms for the default geometry, default date and any indexed attributes, *Frequencies for any indexed attributes...

为什么数据量增加时return时间会增加?

./geomesa-redis export -u localhost:6379 -c geomesa -f SignalBuilder -q "cam like '%' and bbox(geo,38,56,39,57)" --hints STATS_STRING='Enumeration(cam)'
INFO  Running export - please wait...
id,stats:String,*geom:Geometry
stat,"{""5798a065-d51e-47a1-b04b-ab48df9f1324"":203215}",POINT (0 0)
INFO  Feature export complete to standard out for 1 features in 2056ms

下一个请求

/geomesa-redis export -u localhost:6379 -c geomesa -f SignalBuilder -q "cam like '%' and bbox(geo,38,56,39,57)" --hints STATS_STRING='Enumeration(cam)'

INFO  Running export - please wait...
id,stats:String,*geom:Geometry
stat,"{""5798a065-d51e-47a1-b04b-ab48df9f1324"":595984}",POINT (0 0)
INFO  Feature export complete to standard out for 1 features in 3418ms

如何理解收集和保存统计信息,并在 returning 提示统计信息时使用,例如 STATS_STRING='MinMax(time)'STATS_STRING='Enumeration(cam)'

以及如何使用 geotools 进行采样? 我接下来试试

geomesa-cassandra export -P 10.200.217.24:9042 -u cassandra -p cassandra \
-k geomesa -c gsm_events -f SignalBuilder \
-q "cam like '%' and time DURING 2021-12-27T16:50:38.004Z/2022-01-26T16:50:38.004Z" \
--hints SAMPLE_BY='cam';SAMPLING=0.000564

但它不起作用。 谢谢你的回答。

当您 运行 导出带有统计数据查询提示时,GeoMesa 将始终 运行 查询。如果要使用缓存的统计信息,请使用所有 GeoMesa 数据存储实现的 stats-* commands instead. In code, you'd use the stats method