Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.
|
Breck Carter
Last modified: May 15, 1996
mail to: bcarter@bcarter.com
[Home]
select plan ( 'select * from customer where id = 101' ) from sys.dummy; Estimate 2 I/O operations Scan customer using primary key for rows where id equals 101 Estimate getting here 1 times select plan ( 'select * from customer where fname = ''Beth''' ) from sys.dummy; Estimate 10 I/O operations Scan customer sequentially Estimate getting here 126 times
See also Exists Versus Count(*).
select * from a, b where a.p = b.q union select * from a, b where a.x = b.ymay run faster than
select * from a, b where a.p = b.q or a.x = b.y
select product.id from product where not exists ( select sales_order_items.id from sales_order_items where sales_order_items.prod_id = product.id )Correlated subselects can be very slow if the inner result set is re-selected for each and every candidate row in the outer result set. Alternative SQL can sometimes look rather bizarre but it's usually worth the effort. In Watcom SQL the following select runs almost 4 times faster by using an outer join instead of a correlated subselect:
select product.id from product left outer join sales_order_items on product.id = sales_order_items.prod_id where IfNull ( sales_order_items.id, 1, 0 ) = 1