oracle优化器
What circumstances we use ALL_ROWS and what circumstances we use FIRST_ROWS optimizer mode? This article is written in oracle9i.
First_rows attempts to optimize the query to get the very first row back to the client as fast as possible. This is good for an interactive client server environment where the client runs a query and shows the user the first 10 rows or so and waits for them to page down to get more.
All_rows attempts to optimize the query to get the very last row as fast as possible. This makes sense in a stored procedure for example where the client does not regain control until the stored procedure completes. You don't care if you have to wait to get the first row if the last row gets back to you twice as fast. In a client server/interactive application you may well care about that.
In TOAD or SQL Navigator, When we select the data, it display immediately. But it does not mean that, it is faster. If we scroll down, it might be fetching the data in the background mode. First_rows is best place for OLTP environment. Also in some reporting environment, if user wants to see initial data first and later see the rest of the data, then first_rows is good option. When we run the query in the stored procedure, first_rows would not be a good choice, all_rows is good option here, because, there is no use to fetch the first few records immediatley inside the stored procedure.
Let us demonstrate the FIRST_ROWS/ALL_ROWS optimizer hint.
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> create table testtable as select * from user_objects;
Table created.
SQL> create index idx on testtable(object_type);
Index created.
SQL> EXECUTE DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => 'SCREPORT',TABNAME => 'TESTTABLE',ESTIMATE_PER
CENT => 10, METHOD_OPT => 'FOR ALL COLUMNS SIZE 1', CASCADE => TRUE);
PL/SQL procedure successfully co
相关文档:
1.2 管理Jobs
1.2.1 启用Jobs
前面创建JOB时,由于未显式的指定ENABLED参数,因此即使指定了START_DATE,不过默认情况下JOB不会自动执行。对于这种情况,DBMS_SCHEDULER包中提供了一个过程ENABLE,可以用来修改JOB的启用状态,调用方式非常简单,例如:
SQL> exec dbms_scheduler.enable(& ......
Webspere配备Oracle RAC集群数据源,Oracle双机的IP为10.10.10.121与10.10.10.122 ,范例名位别为orcl一与orcl二,服务名叫oracledbservice,采取联接串应为:
jdbc:oracle:thin:@(description=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.121)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10 ......
--1查看表空间已经使用的百分比
select a.tablespace_name,a.bytes/1024/1024
"Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024
"free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used"
from
(select tablespace_nam ......
在VS中写SQL语句的时候,千万万千要小心再小心,比如 说 数据类型的匹配, 单引号(这个能把人迷死)
where 子句中可千万不能有空格(当查询条件为字符串的时候能把你弄疯,我弄这个的时候都疯了几次了,什么都对就是查不出来,调试了N遍才发现。)不行了,吃饭去,再不吃看见活人都想咬了。 ......
在sql语句中涉及到时间类型时 若只想要日期 to_date('2007-7-8','yyyy-mm-dd')
在C#中有datetime类型,代码说明一切
DateTime dt = System.DateTime.Now;
string lsh;
lsh=string.Format("{0:yyyyMMddHHmmss}", dt);
DateTime dt = DateTime.Now;
Label1.Text = dt.To ......