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
CREATE TABLE IF NOT EXISTS user_actions(
id text,
msg_id integer,
msg text,
PRIMARY KEY(id, msg_id)
)
Insert about 1000 msg_ids for each user. Confirm that user 'u-0-10' has 1000 rows.
postgres=# select count(*) from user_actions where id='u-0-10';
count
-------
1000
(1 row)
Time: 8.730 ms
Looking up a specific msg with equality predicate is pretty fast:
postgres=# select * from user_actions where id='u-0-10' and msg_id=10;
id | msg_id | msg
--------+--------+-------------
u-0-10 | 10 | msg--10--10
(1 row)
Time: 0.883 ms
Looking up a specific msg or few msgs with a range predicate seems to go scan all the 1000 rows of user 'u-0-10' (since time seems similar to the count(*) query above) instead of pushing the range predicate down to the DocDB layer, and hence much slower than expected:
postgres=# select * from user_actions where id='u-0-10' and msg_id>=10 and msg_id<11;
id | msg_id | msg
--------+--------+-------------
u-0-10 | 10 | msg--10--10
(1 row)
Time: 8.116 ms
The text was updated successfully, but these errors were encountered:
Sample table:
Insert about 1000
msg_id
s for each user. Confirm that user 'u-0-10' has 1000 rows.Looking up a specific msg with equality predicate is pretty fast:
Looking up a specific msg or few msgs with a range predicate seems to go scan all the 1000 rows of user 'u-0-10' (since time seems similar to the count(*) query above) instead of pushing the range predicate down to the DocDB layer, and hence much slower than expected:
The text was updated successfully, but these errors were encountered: