代码改变世界

随笔档案-2011年6月16日

利用递归WITH子查询进行优化的实例

2011-06-16 17:29 by Tracy., 759 阅读, 收藏,
摘要: 利用递归WITH子查询进行优化的实例 递归WITH子查询我已经用过不少了,不过都是当作玩具,没有在实践中用过。昨天碰到了一个实用例子。 在一个OLTP中有一张表,主键是随着创建时间递增的。每天产生大约1万条记录,全表大约有几百万,没有分区,创建时间没有索引。 现在要求取出最近两天的数据并且从中过滤出部分记录。过滤条件上也没有索引。 原来的查询为全表扫描,效率太低,有没有办法改善?前提:因为原表索... 阅读全文

Oracle Clusters

2011-06-16 17:02 by Tracy., 461 阅读, 收藏,
摘要: A cluster is a schema object that contains one or more tables that all have one or more columns in common. Rows of one or more tables that share the same value in these common columns are physically s... 阅读全文

Dingjun123 :使用Partitioned Outer Join实现稠化报表

2011-06-16 15:22 by Tracy., 414 阅读, 收藏,
摘要: 使用Partitioned Outer Join实现稠化报表 作者:丁俊(dingjun123) 背景介绍:在数据库表中,存储的数据经常是稀疏数据(sparse data),而不是稠密数据(dense data)。先来了解一下什么是稀疏数据,比如一个产品销售情况表(比如有产品名、销售时间(精确到年月)、销售量3个列),假设某个时间某些产品它没有销售,一般也不会将这些产品的销售量存储为0,而是不存... 阅读全文

What are the difference between DDL, DML and DCL commands?

2011-06-16 10:08 by Tracy., 297 阅读, 收藏,
摘要: DDL Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples: CREATE - to create objects in the database ALTER - alters the structure of the databas... 阅读全文

正则表达式使用一例

2011-06-16 08:58 by Tracy., 364 阅读, 收藏,
摘要: 如何用正则表达式实现这样的需求 通过wm_concat()函数得到了这样的结果: '014,014,018,022,317,319,023,021' 如何继续排序和去重复呢? 期望结果:'014,018,021,022,023,317,319' 测试数据: select '014,014,018,022,317,319,023,021' from dual; wm_concat集合函数在plsq... 阅读全文