<tfoot id='xTFop'></tfoot>

    1. <legend id='xTFop'><style id='xTFop'><dir id='xTFop'><q id='xTFop'></q></dir></style></legend>

      <small id='xTFop'></small><noframes id='xTFop'>

    2. <i id='xTFop'><tr id='xTFop'><dt id='xTFop'><q id='xTFop'><span id='xTFop'><b id='xTFop'><form id='xTFop'><ins id='xTFop'></ins><ul id='xTFop'></ul><sub id='xTFop'></sub></form><legend id='xTFop'></legend><bdo id='xTFop'><pre id='xTFop'><center id='xTFop'></center></pre></bdo></b><th id='xTFop'></th></span></q></dt></tr></i><div id='xTFop'><tfoot id='xTFop'></tfoot><dl id='xTFop'><fieldset id='xTFop'></fieldset></dl></div>
        <bdo id='xTFop'></bdo><ul id='xTFop'></ul>
    3. Mysql选择不在表中的位置

      Mysql select where not in table(Mysql选择不在表中的位置)

        • <i id='KMTW2'><tr id='KMTW2'><dt id='KMTW2'><q id='KMTW2'><span id='KMTW2'><b id='KMTW2'><form id='KMTW2'><ins id='KMTW2'></ins><ul id='KMTW2'></ul><sub id='KMTW2'></sub></form><legend id='KMTW2'></legend><bdo id='KMTW2'><pre id='KMTW2'><center id='KMTW2'></center></pre></bdo></b><th id='KMTW2'></th></span></q></dt></tr></i><div id='KMTW2'><tfoot id='KMTW2'></tfoot><dl id='KMTW2'><fieldset id='KMTW2'></fieldset></dl></div>

            <tfoot id='KMTW2'></tfoot>

                <tbody id='KMTW2'></tbody>
            1. <small id='KMTW2'></small><noframes id='KMTW2'>

              <legend id='KMTW2'><style id='KMTW2'><dir id='KMTW2'><q id='KMTW2'></q></dir></style></legend>
              • <bdo id='KMTW2'></bdo><ul id='KMTW2'></ul>
              • 本文介绍了Mysql选择不在表中的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有 2 个表(A 和 B)具有相同的主键.我想选择 A 中而不是 B 中的所有行.以下工作:

                I have 2 tables (A and B) with the same primary keys. I want to select all row that are in A and not in B. The following works:

                select * from A where not exists (select * from B where A.pk=B.pk);
                

                但是它看起来很糟糕(A 中只有 100k 行约 2 秒,B 中少 3-10k)

                however it seems quite bad (~2 sec on only 100k rows in A and 3-10k less in B)

                有没有更好的方法来运行它?也许作为左连接?

                Is there a better way to run this? Perhaps as a left join?

                select * from A left join B on A.x=B.y where B.y is null;
                

                在我的数据上,这似乎运行得稍微快一些(~10%),但一般情况下呢?

                On my data this seems to run slightly faster (~10%) but what about in general?

                推荐答案

                我以您第二个示例的格式使用查询.联接通常比相关子查询更具可扩展性.

                I use queries in the format of your second example. A join is usually more scalable than a correlated subquery.

                这篇关于Mysql选择不在表中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)

                    <i id='HkLcX'><tr id='HkLcX'><dt id='HkLcX'><q id='HkLcX'><span id='HkLcX'><b id='HkLcX'><form id='HkLcX'><ins id='HkLcX'></ins><ul id='HkLcX'></ul><sub id='HkLcX'></sub></form><legend id='HkLcX'></legend><bdo id='HkLcX'><pre id='HkLcX'><center id='HkLcX'></center></pre></bdo></b><th id='HkLcX'></th></span></q></dt></tr></i><div id='HkLcX'><tfoot id='HkLcX'></tfoot><dl id='HkLcX'><fieldset id='HkLcX'></fieldset></dl></div>
                      <bdo id='HkLcX'></bdo><ul id='HkLcX'></ul>

                          <tbody id='HkLcX'></tbody>
                        <legend id='HkLcX'><style id='HkLcX'><dir id='HkLcX'><q id='HkLcX'></q></dir></style></legend>

                      1. <tfoot id='HkLcX'></tfoot>
                        • <small id='HkLcX'></small><noframes id='HkLcX'>