Oracle SQL "not in" statement optimization, query a table has, B table does not have data

Source: Internet
Author: User

In the case of a large record, the not in query will certainly be slow and unacceptable. Like what:

SELECT A.*  fromWHERE A.user_id not in (SELECT B.user_id from Table_b)

the best way to find it now is to check it in seconds. For example, query the DEPT_ID data with table A and b not available:

SELECT A.*from  tb_dept A, Tb_dept_lev BWHERE= b.dept_id (+)  and  is NULL

The (+) number can be understood as: + is added, which table has a plus sign, and this table is the matching table. Here the plus sign is written in the right table, the left table is all displayed, so it is left connected.

Original: http://blog.csdn.net/dengjh_business/article/details/35226227

Oracle SQL "not in" statement optimization, query a table has, B table does not have data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.