Sunday, April 11, 2010

Oracle Hints

select /*+ first_rows(10) */ customer_id,c.first_name,last_name,city,country,order_total
from customer c
natural join orders o
natural join order_items;


returns immediately. There are millions of rows in orders and order_items tables.

SQL> select count(*) from orders;

COUNT(*)
----------
107508853

SQL> select count(*) from order_items;

COUNT(*)
----------
1028941975

SQL> select count(*) from customer;

COUNT(*)
----------
601

No comments:

Post a Comment

Followers

About Me

Torrance, CA, United States