oracle11g具有自动的表压缩功能, 但当insert语句未指定具体的列名时, 会使用自动表压缩功能失效。(如该语句会使得表t_test不能自动压缩: insert into t_test select * from t_test2)
另外使用一些外部工具进行数据装载(sqlload),也有可能使得表不能自动压缩,此时需要用以下语句,以重新分析表,分析完成之后,该表即会自动压缩。
alter table t_tablename move;
alter index t_indexname rebuild; --如果该表有索引的话,还需要重建索引
analyze table t_tablename compute statistics; --重新分析 ......
文章提到,用Cache hit ratio的方法来检查ORACLE性能问题过时了,里面有句非常形象的话:这无异于一个医生只知道根据血压的来治疗病人,而病人由于疼痛,神经兴奋,血压在一个合理的范围内,医生却告诉患者,你没病,等你血压低的时候再来。同样的,我们不能仅仅根据Cache hit ratio来判断ORACLE数据库是否出了问题,需要综合考虑,我们DBA能当那个医生吗?
高的cache hit ratio 不能说明性能就一定很好,低的cache hit ratio也不总是说性能不好,事实上有很多时候,cache hit ratio 经常很低,但是性能却没有丢失。
文章又提到,OWI是我们首选的调方法,在ORACLE10gEM performance的页面也没有出现cache hit ratio,它被ORACLE抛弃了。
现在看到第一张第五页.....明天继续。
现在ORACLE提出了数据库响应时间(Response Time)的调整模型 Response Time=ServiceTime+WaitTime.
ServiceTime 是一个进程花费在CPU上的总时间,WaitTime是一个进程为了继续工作而等待所需资源的总时间。一个进程要么 ......
oracle 方法 postgreSQL方法
select seqName.nextval from dual select nextval('seqname')
select seqName.currval from dual select currval('seqname')
long 字段 &nb ......
oracle 方法 postgreSQL方法
select seqName.nextval from dual select nextval('seqname')
select seqName.currval from dual select currval('seqname')
long 字段 &nb ......
在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据库的处理时间,以下就是常用SQL分页处理:
1、SQL Server、Access数据库
这都微软的数据库,都是一家人,基本的操作都是差不多,常采用如下分页语句:
PAGESIZE:每页显示的记录数
CURRENTPAGE:当前页号
数据表的名字是:components
索引主键字是:id
以下是引用片段:
select top PAGESIZE * from components where id not in
(select top (PAGESIZE*(CURRENTPAGE-1))
id from components order by id)order by id
如下列:
以下是引用片段:
select top 10 * from components where id not in
(select top 10*10 id&nbs ......
在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据库的处理时间,以下就是常用SQL分页处理:
1、SQL Server、Access数据库
这都微软的数据库,都是一家人,基本的操作都是差不多,常采用如下分页语句:
PAGESIZE:每页显示的记录数
CURRENTPAGE:当前页号
数据表的名字是:components
索引主键字是:id
以下是引用片段:
select top PAGESIZE * from components where id not in
(select top (PAGESIZE*(CURRENTPAGE-1))
id from components order by id)order by id
如下列:
以下是引用片段:
select top 10 * from components where id not in
(select top 10*10 id&nbs ......
在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据库的处理时间,以下就是常用SQL分页处理:
1、SQL Server、Access数据库
这都微软的数据库,都是一家人,基本的操作都是差不多,常采用如下分页语句:
PAGESIZE:每页显示的记录数
CURRENTPAGE:当前页号
数据表的名字是:components
索引主键字是:id
以下是引用片段:
select top PAGESIZE * from components where id not in
(select top (PAGESIZE*(CURRENTPAGE-1))
id from components order by id)order by id
如下列:
以下是引用片段:
select top 10 * from components where id not in
(select top 10*10 id&nbs ......
in 的话, 如果是null 就不比较了,既不是in 也不是 not in
exists的话 因为用 = 加在条件里比较了,所以 null 是 not exists
select *
from pricetemp
where cast(商品コード as varchar(10))not in(
select shohin_cd
from m_price)
select *
from pricetemp
where not exists (select shohin_cd
from m_price
where cast(pricetemp.商品コード as varchar(10))=m_price.shohin_cd)
以上2条会有不同的结果,因为 pricetemp.商品コード 有很多 null ......
in 的话, 如果是null 就不比较了,既不是in 也不是 not in
exists的话 因为用 = 加在条件里比较了,所以 null 是 not exists
select *
from pricetemp
where cast(商品コード as varchar(10))not in(
select shohin_cd
from m_price)
select *
from pricetemp
where not exists (select shohin_cd
from m_price
where cast(pricetemp.商品コード as varchar(10))=m_price.shohin_cd)
以上2条会有不同的结果,因为 pricetemp.商品コード 有很多 null ......
1.首先需要建立plan table,否则不能使用
建立方法:
$oracle\rdbms\admin下有个
utlxplan.sql
其内容为:
create table PLAN_TABLE (
statement_id varchar2(30),
timestamp date,
remarks varchar2(80),
operation varchar2(30),
options varchar2(255),
object_node varchar2(128),
object_owner varchar2(30),
object_name varchar2(30),
object_instance numeric,
object_type varchar2(30),
optimizer varchar2(255),
search_columns number,
id numeric,
parent_id numeric,
position numeric,
cost numeric,
cardinality numeric,
bytes numeric,
other_tag varchar2(255),
&nbs ......
1.首先需要建立plan table,否则不能使用
建立方法:
$oracle\rdbms\admin下有个
utlxplan.sql
其内容为:
create table PLAN_TABLE (
statement_id varchar2(30),
timestamp date,
remarks varchar2(80),
operation varchar2(30),
options varchar2(255),
object_node varchar2(128),
object_owner varchar2(30),
object_name varchar2(30),
object_instance numeric,
object_type varchar2(30),
optimizer varchar2(255),
search_columns number,
id numeric,
parent_id numeric,
position numeric,
cost numeric,
cardinality numeric,
bytes numeric,
other_tag varchar2(255),
&nbs ......