avatar
compare two large tables SQL# JobHunting - 待字闺中
l*9
1
I am comparing two tables to make sure they are same row by row and column
by column on SQL server.
SELECT *
FROM t1, t2
WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
The tables are vey large, more than 100 million.
I got error:
ERROR [HY000] ERROR: 9434 : Not enough memory for merge-style join
Are there better ways to do this comparison.
thanks !
avatar
l*8
2
CREATE UNIQUE INDEX
ON t1(column1, column2, column3);
CREATE UNIQUE INDEX
ON t2(column1, column2, column3);
SELECT 'different'
FROM dual
WHERE EXIST
(
SELECT *
FROM t1, t2
WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
);

【在 l******9 的大作中提到】
: I am comparing two tables to make sure they are same row by row and column
: by column on SQL server.
: SELECT *
: FROM t1, t2
: WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
: AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
: The tables are vey large, more than 100 million.
: I got error:
: ERROR [HY000] ERROR: 9434 : Not enough memory for merge-style join
: Are there better ways to do this comparison.

avatar
l*9
3
i got error:
CREATE UNIQUE INDEX Pindex1
ON t1 (column1, column2, column3);
ERROR [HY000] ERROR: CREATE INDEX not supported in this release
Thanks

【在 l*********8 的大作中提到】
: CREATE UNIQUE INDEX
: ON t1(column1, column2, column3);
: CREATE UNIQUE INDEX
: ON t2(column1, column2, column3);
: SELECT 'different'
: FROM dual
: WHERE EXIST
: (
: SELECT *
: FROM t1, t2

avatar
l*8
4
不让建索引太奇怪了。
看了一下, 你这个好像是IBM一个系统里的SQL。 不知道有哪些限制。

【在 l******9 的大作中提到】
: i got error:
: CREATE UNIQUE INDEX Pindex1
: ON t1 (column1, column2, column3);
: ERROR [HY000] ERROR: CREATE INDEX not supported in this release
: Thanks

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。