You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
In comparison of entries value is the higher part of entry and bloom filter of
path is its lower part. This determines the features of this opclass. Since
value is the higher part of entry we canperformonly exact value search
efficiently. Range valuesearch is possible as well but we would have to
filter all the the different paths where matching values occur. Bloom filter
over path items allows indexusage for conditions containing `%` and `*` in
thevalue is the higher part ofanentry, we can only perform exact value search
effectively. Asearchover a range of valuesis possible as well, but we have to
filter all the the different paths where matching values occur.TheBloom filter
over path items allowstheindexto be used for conditions containing `%` and `*` in
their paths.
### Query optimization
JsQuery opclasses perform complex query optimization.Thus it's valuable for
JsQuery opclasses perform complex query optimization.It's valuable for a
developer or administrator to see the result of such optimization.
Unfortunately, opclasses aren't allowed todo any custom outputto the
EXPLAIN. That's why JsQuery providesfollowing functionswhich allows to see
how particular opclass optimizes given query.
Unfortunately, opclasses aren't allowed toput any custom outputin an
EXPLAIN. That's why JsQuery providesthese functionsto let you see
how particular opclass optimizes given query:
* gin\_debug\_query\_path\_value(jsquery) – for jsonb\_path\_value\_ops
* gin\_debug\_query\_value\_path(jsquery) – for jsonb\_value\_path\_ops
Resultof these functions is a textual representation of query tree which
leafs are GIN search entries. Following examples show different results of
query optimization by different opclasses.
The resultof these functions is a textual representation ofthequery tree
where leaves are GIN search entries. Following examples show different results of
query optimization by different opclasses:
# SELECT gin_debug_query_path_value('x = 1 AND (*.y = 1 OR y = 2)');
gin_debug_query_path_value
Expand All
@@ -309,29 +307,29 @@ query optimization by different opclasses.
Unfortunately, jsonb have no statistics yet. That's why JsQuery optimizer has
to do imperative decision while selecting conditions to be evaluated using
index. This decision is made byassumtion that some condition types are less
selective than others.Optimizer divides conditions into following selectivity
class (listedby descending of selectivity).
index. This decision is made byassuming that some condition types are less
selective than others.The optimizer divides conditions into following selectivity
classes (listedin descendingorderof selectivity):
1. Equality (x = c)
2. Range (c1 < x < c2)
3. Inequality (x > c)
4. Is (x is type)
5. Any (x = \*)
Optimizer evades index evaluation of less selective conditions when possible.
The optimizer avoids index evaluation of less selective conditions when possible.
For example, in the `x = 1 AND y > 0` query `x = 1` is assumed to be more
selective than `y > 0`. That's why index isn't used for evaluation of `y > 0`.
selective than `y > 0`. That's whytheindex isn't used for evaluation of `y > 0`.
# SELECT gin_debug_query_path_value('x = 1 AND y > 0');
gin_debug_query_path_value
----------------------------
x = 1 , entry 0 +
With lack of statistics decisions made by optimizer can be inaccurate. That's
why JsQuery supports hints.Comments`/*-- index */`and `/*-- noindex */`
placed in the conditionsforcesoptimizer to useand not use index
correspondingly.
Withthelack of statistics, decisions made by optimizer can be inaccurate. That's
why JsQuery supports hints.The comments`/*-- index */`or `/*-- noindex */`
placed in the conditionsforce theoptimizer to useor not use an index
correspondingly:
SELECT gin_debug_query_path_value('x = 1 AND y /*-- index */ > 0');
gin_debug_query_path_value
Expand All
@@ -348,11 +346,11 @@ correspondingly.
Contribution
------------
Please, notice, that JsQuery is still under development and while it's
stable and tested, it maycontains some bugs. Don't hesitate toraise
Please note that JsQuery is still under development. While it's
stable and tested, it maycontain some bugs. Don't hesitate tocreate
[issues at github](https://github.com/postgrespro/jsquery/issues) with your
bug reports.
If you're lacking of some functionality in JsQuery andfeeling power to
implement it then you're welcome to make pull requests.
Ifthere's some functionalityyou'd like to see added to JsQuery andyou feel
like you canimplement it, then you're welcome to make pull requests.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.