Comparison of data query methods

Source: Internet
Author: User

Search Method

Disadvantages

Advantages

Locate

All data will be downloaded from the data source. If the data table contains a large amount of data, the execution efficiency will be very slow, and it will easily cause the client to become a machine.

The query data execution efficiency remains stable, regardless of whether the data to be searched already exists in the result data set, and there are no other side effects

Use clonecursor

If the data to be searched is not in the result data set, all the data in the data table will be downloaded, and the performance is slower than using the locate method.

If the data to be searched already exists in the result data set, it can avoid downloading all the data and quickly locate the data to be searched.

Use clonecursor to add SQL statements and appenddata

Possible side effects of duplicate data

Provides the fastest query efficiency, regardless of whether the data is in the result data set or the back-end data source. At the same time, the downloaded data volume is the least, and the network load is the least.

Use copy data

The program must copy some additional data.

It provides better search efficiency than direct use of locate and other methods, without the disadvantages of the clonecursor method or the side effects of clonecursor and SQL statements

Additional description: The Method for Improving the query speed in SQL.

To ensure that duplicate values are eliminated, subqueries must process nested queries for each result of an external query. In this case, you can consider using join queries instead.
If you want to use a subquery, use exists instead of in and not exists instead of not in. Because the subquery introduced by exists only tests whether there are rows that meet the specified conditions in the subquery, the efficiency is high. In either case, not in is the most inefficient. Because it executes a full table traversal for the table in the subquery.

Create a proper index to avoid scanning excess data and table scanning!
Millions of data records can be queried in dozens of milliseconds.

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.