1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by
涉及的列上建立索引。2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如:select id from
t where num is null可以在num...
分类:
数据库 时间:
2014-05-01 13:23:55
阅读次数:
443
DescriptionAstronomers often examine star maps
where stars are represented by points on a plane and each star has Cartesian
coordinates. Let the level...
分类:
其他好文 时间:
2014-05-01 05:42:32
阅读次数:
368
1、IN操作符用IN操作符写出来的SQL直观简单、易于理解。但是在where条件中使用IN操作符是低效的。例如下面这条查询语句:SELECT
* FROM tab_a WHERE id IN(SELECT a_id FROM tab_b);
你认为它会怎么执行呢?先从tab_a表中遍历数据,然后拿每...
分类:
数据库 时间:
2014-05-01 03:28:11
阅读次数:
756
连接就是将两个表按照某个公共字段来拼成一个大表。
左连接就是在做连接是以左边这个表为标准,来遍历右边的表。
例子:
用户访问记录:
问题:查出看了湖南卫视但没有看北京卫视的用户信息
逻辑:先通过左连接将看了湖南卫视和北京卫视的查出来,然后再将看了湖南卫视但不在刚才查出的结果中的用户查出来。
SELECT * FROM test_visit WHERE channel='...
分类:
数据库 时间:
2014-04-30 22:31:39
阅读次数:
401
经常会遇到一个会话中存在sql性能问题,但无法定位哪一个sql导致DB性能问题较高,这是我们需要对这个session进行监控可以通过dbms_monitor包来实现。
首先确定要监控的会话sid及serial#,可以通过v$session视图获得
select sid, serial#, username from v$session where ...
确定session...
分类:
数据库 时间:
2014-04-30 22:23:38
阅读次数:
413
Pat1063代码
题目描述:
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets,
and Nt is the to...
分类:
其他好文 时间:
2014-04-29 13:44:20
阅读次数:
325
NSPredicate:对self每个对象通过谓词进行筛选,判断是否与条件相匹配。原理和用法都类似于SQL查询中的where,作用相当于数据库的过滤取。主要用于从集合中分拣出符合条件的对象,也可以用于字符串的正则匹配
第一、contains 判断
NSArray *array = [[NSArray
alloc]initWithObjects:@"beijing",@"s...
分类:
其他好文 时间:
2014-04-29 13:32:23
阅读次数:
375
在11g中,默认自动收集统计信息的时间为晚上10点(周一到周五,4个小时),早上6点(周六,周日,20个小时),如下所示:
select a.window_name, a.repeat_interval,a.duration
from dba_scheduler_windows a, dba_scheduler_wingroup_members b
where a.window_na...
分类:
数据库 时间:
2014-04-29 13:28:21
阅读次数:
469
Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two endpoints of line i is at (i, ai) and (i,
0). Fin...
分类:
其他好文 时间:
2014-04-29 13:15:21
阅读次数:
415
Problem 2167 大王叫我来巡山呐
比赛的第二题 呵呵
Problem 2168 防守阵地 I
比赛时看懂第一题 大了下草稿 马上切了它
假设当前x=(ai)*1+(ai+1)*2+(ai+2)*3+''''+(aj)*m
下一次是(ai+1)*1+(ai+2)*2+(ai+3)*3+''''+(aj+1)*m = (ai)*1+(ai+1)*2+(ai+2)*3+''''+(a...
分类:
其他好文 时间:
2014-04-27 21:46:59
阅读次数:
224