Open DreamVersion opened 1 year ago
Can you tell me which version of the library you are using and the size of your collection? If the collection is big, you should probably use indexes, which are available in the v2 version Anyway, using string dates is not a good idea for comparison
I'm using v2 version and collection about 140Mb. I try to use time.Time type, but get the same result. I see only support one index, then ad_id is the index. The size of docs when ad_id="1749344214764583" is about 10. Range query of this 10 docs expects to be very fast.
So do you have an index set on ad_id?
query like
query :=clover.NewQuery("stat"). Where(clover.Field("stat_time").GtEq("2022-11-14"). And(clover.Field("stat_time").LtEq("2022-11-15")). And(clover.Field("ad_id").Eq("1749344214764583"))). Sort(clover.SortOption{Field: "stat_time", Direction: 1})
very fast. butquery :=clover.NewQuery("stat"). Where(clover.Field("ad_id").Eq("1749344214764583")). And(clover.Field("stat_time").LtEq("2022-11-15")). And(clover.Field("stat_time").GtEq("2022-11-14")). Sort(clover.SortOption{Field: "stat_time", Direction: 1})
very slow. Why?