易截截图软件、单文件、免安装、纯绿色、仅160KB

ORACLE中查看SQL执行计划的方法

 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),
 partition_start varchar2(255),
        partition_stop  varchar2(255),
        partition_id    numeric,
 other  long,
 distribution    varchar2(30),
 cpu_cost numeric,
 io_cost  numeric,
 temp_space numeric,
        access_predicates varchar2(4000),
        filter_predicates varchar2(4000));
运行此SQL
SQL>$ORACLE/rdbms/admin/utlxplan.sql
2.使用explain plan for语句进行执行计划分析
SQL> explain plan for
  2  select * from dual;
已解释。
出现上述结果,表明分析完毕,可以查看
3.可以查看执行计划了
select * from table(DBMS_XPLAN.display);
--------------------------------------------------------------------
| Id  | Operation            |  Name    


相关文档:

SQL语句PART10

oracle tips
Exist的用法:
select gw.ndocid from 
(select ndocid from wf_doc_gw_shouwen union select ndocid from wf_doc_gw_fawen) gw
where
not exists (select null from wf_doc_gw_sn sn where sn.ndocid=gw.ndocid)
2。把GW表和SN表里相同的NDOCID显示出来
select gw.ndocid from 
(se ......

Oracle、SQL Server、Access数据库高效果分页技巧

 在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据 ......

SQL Server系统视图


--> Title  : SQL Server系统视图
--> Author : wufeng4552
--> Date   : 2009-10-28
 
目录视图
目录视图返回 SQL Server 数据库引擎使用的信息。建议您使用目录视图这一最常用的目录元数据界面,它可为您提供最有效的方法来获取、转换并显示此信息的自定义形式。所有用户可用目录元 ......

SQL连接类

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace DAL
{ ......

sql 修改列名及表名

代码如下:
EXEC sp_rename '表名.[原列名]', '新列名', 'column'
*************************************************************************
Transact-SQL 参考
sp_rename
更改当前数据库中用户创建对象(如表、列或用户定义数据类型)的名称。
示例
A. 重命名表
下例将表 customers 重命名为 custs。 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号