INF: Complexity of WHERE Clauses in SQL ServerID: Q75404
|
There is no simple limit on the complexity of a WHERE clause.
The terms in a WHERE clause such as
WHERE ((c1= '10') or (c1= '20') or (c1= '40'))
AND ((c2 = 'aa') or (c2 = 'bb') or (c2 = 'cc'))
AND (c3 = 'mm')
AND ((c4 = 'aaabbbccc') or (c4 = 'bbbcccdd'))
AND ((c5 = '11111') or (c5 = '22222'))
WHERE-->AND->OR->(c1='10')
| |
| OR->(c1='20')
| :
|
AND->OR->(c2='aa')
| |
| OR->(c2='bb')
| :
|
AND->OR->(c3='mm')
: :
This illustrates that the only limit is the storage available for the linked lists. Each node has a pair of pointers (4 bytes each) and some status information (<10 bytes). Nodes that represent constants (such as 'aaabbbccc') require additional space for the constant. When the tree representing the entire SQL statement exceeds available storage in procedure cache, a message to that effect appears (#703).
Additional query words: dblib
Keywords : kbprg SSrvDB_Lib SSrvTrans SSrvServer
Version : 4.2
Platform : OS/2
Issue type :
Last Reviewed: March 11, 1999