Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document selectivity hints #144

Open
dimas-b opened this issue Jul 26, 2021 · 0 comments
Open

Document selectivity hints #144

dimas-b opened this issue Jul 26, 2021 · 0 comments

Comments

@dimas-b
Copy link

dimas-b commented Jul 26, 2021

stargate/stargate#1134 and stargate/stargate#1138 allow users to provide selectivity hints in Docs API queries.

Swagger nodes seem to offer to little space for a full description of the new query parameter, though, so we should probably add a section about it to the docs.

Selectivity is a value between 0 and 1 (inclusive) that represents the percentage of rows are expected to be matched by this filter.

Example: where={"fieldA": {"$eq": 1, "$selectivity": 0.8}, "fieldB: {"$eq": 2, "$selectivity": 0.5}}

$selectivity values can be specified in the same JSON block that defies the filter operation and its value, as long as there's only one filter operation in enclosed in a JSON object. If more than one filter are applied to the same field and selectivity hints need to be specified, the filters have to be combined using an explicit boolen operator (e.g. $and).

By default, filters that do not have an explicit selectivity hint provided by the query get the selectivity value of 1.0 (the worst possible selectivity).

Stargate Docs API uses selectivity hints to optimize its query plans. The filter with the best selectivity is usually executed first, but the selectivity hints do not completely override the query engine decisions.

The user can utilize the $profile=true query option to see the effects of different selectivity hints on the final query plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants