我有下一个表结构:
SELECT * FROM v WHERE uid = 0x5103be34e695ba3c31000000;
uid | cid | v
----------------------------+-----------+-------
0x5103be34e695ba3c31000000 | 02j1Dy9G1 | True
0x5103be34e695ba3c31000000 | 03szNx7G1 | False
0x5103be34e695ba3c31000000 | 0SREjO9G1 | True
0x5103be34e695ba3c31000000 | 0bQ4Qn9G1 | True
0x5103be34e695ba3c31000000 | 0ojEVLWF1 | True
0x5103be34e695ba3c31000000 | 1NiWfO9G1 | True
0x5103be34e695ba3c31000000 | 1fSmhWGF1 | True
0x5103be34e695ba3c31000000 | 1o0Ri3TF1 | True
用户 (uid) 喜欢 (True) 或不喜欢 (False) 内容 (cid)
“用户喜欢内容吗?”
SELECT * FROM v WHERE uid = 0x5103be34e695ba3c31000000 AND cid IN ('Rqy9V79J',....more than 2000 cids...);
rpc timeout
Normal SELECT * FROM v WHERE uid = 0x5103be34e695ba3c31000000 works very fast.
如何使用 IN 加快读取请求?其他数据结构?有任何想法吗?