Skip to content

Commit 9841deb

Browse files
committed
add workaround for query with many expressions
1 parent 3d93f02 commit 9841deb

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

docs/t-sql/language-elements/expressions-transact-sql.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,25 @@ GO
122122
```
123123

124124
The expression `1+2` evaluates to `3` in each row in the result set. Although the expression `ProductID` generates a unique value in each result set row, each row only has one value for `ProductID`.
125-
125+
126+
- Azure SQL Data Warehouse allocates a fixed maximum amount of memory to each thread so no thread can use up all the memory. Some of this memory is used for storing queries’ expressions. If a query has too many expressions and its required memory exceeds the internal limit, the engine will not execute it. To avoid this problem, users can change the query into multiple queries with smaller number of expressions in each. For example, you have 1000 lines of similar expressions in the WHERE clause:
127+
128+
```sql
129+
DELETE FROM dbo.MyTable
130+
WHERE
131+
(c1 = '0000001' AND c2 = 'A000001') or
132+
(c1 = '0000002' AND c2 = 'A000001') or
133+
...
134+
135+
```
136+
Change this query to:
137+
138+
```sql
139+
DELETE FROM dbo.MyTable WHERE (c1 = '0000001' AND c2 = 'A000001');
140+
DELETE FROM dbo.MyTable WHERE (c1 = '0000002' AND c2 = 'A000001');
141+
...
142+
```
143+
126144
## See Also
127145
[AT TIME ZONE (Transact-SQL)](../../t-sql/queries/at-time-zone-transact-sql.md)
128146
[CASE (Transact-SQL)](../../t-sql/language-elements/case-transact-sql.md)

0 commit comments

Comments
 (0)