mysql数据库sql语句调优 、
索引设计原则:
索引列一般为where子句中的列或连接字句中的列
尽量不对基数小的列做索引,如性别列
尽可能使用短索引:如果对字符列索引尽量指定最小长度。
(short Keys are better,Integer best)
create index cityname on city(city(10));
复合索引前缀特性,索引的顺序很重要。
...
分类:
数据库 时间:
2015-02-14 11:06:31
阅读次数:
195
题目 判断数独是否成立的一道题,看的是某大神的答案,写的太漂亮了。Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the charact...
分类:
其他好文 时间:
2015-02-13 18:38:44
阅读次数:
114
今天做一个数据的查询$products=M('products');$prodName=isset($_POST['prodName'])?I('post.prodName'):'';$products->join('left join prods on prods.prodId = product...
分类:
Web程序 时间:
2015-02-13 18:24:13
阅读次数:
151
今天在修改项目时,
并没有搜索到结果,控制台就报乱码的错误,如下:
Hibernate: select count(*) as col_0_0_ from PJEDU_SITE site0_ where (site0_.TITLE like '%?±?é?¨%') and (site0_.SITE_CODE like '001___')
比较常见的一般是...
分类:
其他好文 时间:
2015-02-13 16:44:01
阅读次数:
161
if exists ( select * from dbo.sysobjects where id = object_id(N'[dbo].[TableSpace]') and objectproperty(id, N'IsUserTable') = 1 ) drop table [dbo].[T....
分类:
数据库 时间:
2015-02-13 16:13:47
阅读次数:
181
1)查询条件
查询条件概念:
SQL查询语句中,对元组进行过滤和连接的表达式,形式上是出现在WHERE/JOIN-ON/HAVING的子句中的表达式。
2)条件化简技术
①条件下推:把与单个表相关的条件,放到对单表进行扫描的过程中执行。
SELECT *
FROM A, B
WHERE A.a=1 and A.b=B.b;...
分类:
数据库 时间:
2015-02-13 11:41:35
阅读次数:
211
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of ...
分类:
其他好文 时间:
2015-02-13 09:21:11
阅读次数:
155
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that...
分类:
其他好文 时间:
2015-02-12 22:53:43
阅读次数:
207
在数据库中创建表如下,统计每个Task对应的TaskNote有多少条?第一种解决方案:select t.TaskId, (select count(n.ID) from TaskNote n where n.TaskId = t.TaskId) 'Notes', --exec ever...
分类:
数据库 时间:
2015-02-12 22:39:41
阅读次数:
263
题目1001:A+B for Matrices时间限制:1 秒内存限制:32 兆特殊判题:否提交:15235解决:6172题目描述: This time, you are supposed to find A+B where A and B are two matrices, and then co...
分类:
其他好文 时间:
2015-02-12 21:21:21
阅读次数:
234