我有两个问题:
zmqpp::message msg;
int64_t header_1 = 1234567;
msgpack::sbuffer buffer;
msgpack::pack(buffer, header_1);
msg.add_raw(buffer.data(), buffer.size());
和
SELECT m.id, m.name, f.type, c.id
FROM main AS m, filter AS f, city AS c
WHERE m.id = f.id AND c.name = m.city;
两者都应该给我相同的输出。我为一小组值运行它们并且工作正常,但是当我为一组非常大的值运行它们时,两者都返回了非常不同的行数(第一行返回~500K行,而第二行返回~65K行) )。这两个查询有什么不同吗?
[编辑]:
我使用mysql作为RDBMS。
答案 0 :(得分:1)
即使查询#2是推荐标准。两个查询都应返回相同的结果。
我的消化。比较那些分开的连接查询
SELECT m.id, m.name, f.type
FROM main AS m, filter AS f
WHERE m.id = f.id;
SELECT m.id, m.name, f.type
FROM main AS m
INNER JOIN filter as f ON m.id = f.id;
然后
SELECT m.id, m.name, c.id
FROM main AS m, city AS c
WHERE c.name = m.city;
SELECT m.id, m.name, f.type, c.id
FROM main AS m
INNER JOIN city AS c ON c.name = m.city;
如果有任何不同,请告诉我们。 (不应该是任何)