Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geomesa-dev] stats based query optimization on attribute indexes at high zoom levels

Jim has it right - it estimates that there would be fewer rows scanned in the z2 index than hitting the attribute index. The high-cardinality hint causes the cost of an attribute query to be the estimated count divided by 10:

https://github.com/locationtech/geomesa/blob/master/geomesa-accumulo/geomesa-accumulo-datastore/src/main/scala/org/locationtech/geomesa/accumulo/index/attribute/AttributeQueryableIndex.scala#L264

If you know that you want to hit the attribute index, you can use the geoserver 'view params' to to skip the cost-based query planning. In 1.3.0 this would be "QUERY_INDEX" (to correspond to the query hint name), in previous versions it would be "STRATEGY":

https://github.com/locationtech/geomesa/blob/master/geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/geoserver/ViewParams.scala#L54

http://docs.geoserver.org/stable/en/user/data/database/sqlview.html#using-a-parametric-sql-view

so something like: &viewparams=QUERY_INDEX:attr

We could definitely add something like 'highest' if people want that.


On 12/27/2016 11:23 AM, Jim Hughes wrote:
Hi Anthony,

I'd say that the CBO should be relatively 'free' to pick between the Z2 index and the attribute index.

If one zoomed into a few blocks of NYC and was searching for 'pizza', I'd imagine that pulling back POI from a geo-index to be a faster than checking to see which pizza shops were in that part of Queens. On the other hand, if you were using Twitter ID, maybe it makes sense to use the attribute index.

Perhaps, we need a 'cardinality=highest' hint which indicates to always prefer the attribute index and never choose...

Cheers,

Jim

On 12/26/2016 3:28 PM, Anthony Fox wrote:
Hi all,

I've got a quick question about the query planner.  Say I have an
attribute index on an attribute with a high cardinality. Something like
the following sft:

group:String:index=full:cardinality=high,dtg:Date,*geom:Point:srid=4326

When running queries with stats based optimization turned on, I've
noticed that if I am at a high zoom level, the query planner tries to
hit the z2 table.  In my case, I'd expect it to only ever hit the
attribute index.

I think I can use the override to not use stats when query planning but
I wonder if there's a better way.

Thoughts?

Thanks,
Anthony
_______________________________________________
geomesa-dev mailing list
geomesa-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
http://locationtech.org/mailman/listinfo/geomesa-dev


_______________________________________________
geomesa-dev mailing list
geomesa-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
http://locationtech.org/mailman/listinfo/geomesa-dev



Back to the top