SQL Traversal parsing
In SQL stored procedures, functions, it is often necessary to use traversal (traversal table), where a cursor, temporal table, and other traversal methods are common. In the face of small data volume, these kinds of traversal methods are feasible, but faced with large data volume, it is necessary to select the preferred, different traversal methods, there is an exponential difference in efficiency.
This article lists the commonly used 3 traversal methods: cursors, temporal tables, index tables, focusing on their efficiency.
This paper is mainly for the traversal of large amount of data, when the amount of data is the hour, you can choose a traversal method.
The instance data is as follows: altogether 177,471 data
1. Cursor traversal
Traversal of Cursors
2.
22
3.
33
Comparison of several traversal methods in SQL Server