-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
支持多表联合查询吗 #48
Comments
sqlite连表查询性能不是特别好。 我的测试:
连表查询,耗时14秒左右。 所以一般在数据量比较大的时候, 不建议用连表操作。 |
@alexlee002 那你计算过取出数据耗时吗,相加起来比较如何? |
no reply |
@RingoD : 大概是这样的sql select tag_id, count(*) as num from fileMetas as a, file_tags as b where a.fid=b.fid and a.basePath like '/my/path/to/search/%' and b.tag_type=1 group by tag_id order by num desc limit 10;
-- output:
-- total: 12850.468040ms 如果我分成两个SQL分别查询, 然后在内存里边计算: select fid, tag_id from file_tags where tag_type=1;
select fid from fileMetas where basePath like '/my/path/to/search/%';
-- output:
-- total: 1628.209949ms 相差一个数量级, 当然也并非所有连表查询都这样, 实际情况测试之后再选择连表还是自己手动计算。 |
原有的左连右连数据库查询,如果用这个,是不是需要分开来查询
The text was updated successfully, but these errors were encountered: