
Migrating to Sybase Adaptive Server Enterprise 11.5 5-17
Adaptive Server Enterprise 11.5 If Your Current Version is 4.x or 10.x
Subquery Processing Changes
Changes in subquery processing are described in the following
sections:
• Expression Subqueries 5-17
• No set dup in subquery 5-17
• union Limitations 5-18
• Subqueries and NULL Results 5-18
• No Subqueries in Updatable Cursors 5-18
Expression Subqueries
Expression subqueries may be slower in release 11.x than 10.x where:
• The outer table is very large and has few duplicate correlation
values.
• The inner table is small.
• The subquery contains an aggregate.
The optimizer will not flatten this type of query to be processed as a
join. Such a query might look like this:
select * from huge_table where col_x=
(select sum(col_a) from tiny_table
where col_b = huge_table.col_y)
To get faster results, you can reformulate the query to mimic the
behavior of release 10.x, as demonstrated in this example:
select huge_table.col_y, s=sum(col_a)
into #t
from huge_table, tiny_table
where col_b=huge_table.col_y
group by huge_table.col_y
select huge_table.*
from huge_table, #t
where col_x=#t.s
and huge_table.col_y=#t.col_y
No set dup in subquery
The change in the
set dup in subquery command does not affect systems
being upgraded from 4.x, as this command was introduced in
Comentários a estes Manuais