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
The goal of this task is to enable simple query pushdown for querier that look like {_id: <ObjectID>}.
Only that field name (_id) is supported, and only that value type (ObjectID).
In the future, we will add support for other fields (starting with simple scalar fields),
other values (starting with strings, numbers, and other simple scalar values),
other conditions like {_id: <ObjectID>, field: value} (so only the first part is pushed down).
Postgres
If a field name is different, value type is not ObjectID, or some other condition is present,
we should use the previous version of the code that SELECTs the whole table without any WHERE condition.
If the value type is ObjectID but the data in the value is somehow corrupted, raise an error (fjson unmarshal).
If those conditions are met, we send a SELECT query with a WHERE condition.
Proof of concept for a {_id: <ObjectID>} pushdown query, PostgreSQL:
GIN index is not used by PostgreSQL in any queries below.
So let's use the first one just because it is first.
-- this will not use these indexes:-- CREATE INDEX values_id_idx ON public."values" USING gin ((((_jsonb -> '_id'::text) -> '$o'::text)))-- CREATE INDEX values_id_idx ON values (((_jsonb ->> '_id')::text));select*fromvalueswhere (_jsonb->'_id')::jsonb->>'$o'='507f1f77bcf86cd799439011'; -- no, seq scan will it use index? not that indexes
Test
Integration tests: Provide a new test flag that enables a query pushdown.
Run with and without flag: results must be the same.
When explain feature will be ready, compare the query plan.
Support simple query pushdown
The goal of this task is to enable simple query pushdown for querier that look like
{_id: <ObjectID>}
.Only that field name (
_id
) is supported, and only that value type (ObjectID
).In the future, we will add support for other fields (starting with simple scalar fields),
other values (starting with strings, numbers, and other simple scalar values),
other conditions like
{_id: <ObjectID>, field: value}
(so only the first part is pushed down).Postgres
If a field name is different, value type is not
ObjectID
, or some other condition is present,we should use the previous version of the code that SELECTs the whole table without any WHERE condition.
If the value type is
ObjectID
but the data in the value is somehow corrupted, raise an error (fjson
unmarshal).If those conditions are met, we send a SELECT query with a WHERE condition.
Proof of concept for a
{_id: <ObjectID>}
pushdown query, PostgreSQL:GIN index is not used by PostgreSQL in any queries below.
So let's use the first one just because it is first.
Test
Integration tests: Provide a new test flag that enables a query pushdown.
Run with and without flag: results must be the same.
When explain feature will be ready, compare the query plan.
Links
Analysis task: #847
The text was updated successfully, but these errors were encountered: