blackcore

本质的东西,深植于骨骼,扎根于灵魂! 淘实惠,各类电子版书籍

导航

随笔分类 -  Database

[MongoDB]How do I query for fields that have null values?
摘要:{column:null}:结果为column的值为null或记录不包含column字段的数据;{column:{$type:10}}:结果为记录包含column字段且值是null的数据;{column:{$exists:false}}:结果为记录不包含column字段的数据;Fields in a document may storenullvalues, as in a notional collection,test, with the following documents:{ _id: 1, cancelDate: null }{ _id: 2 }Different query op 阅读全文

posted @ 2013-01-10 13:40 blackcore 阅读(645) 评论(0) 推荐(0)

mysql 查询缓存
摘要:mysql服务器的查询缓存开启,查看查询缓存参数如下命令如下:#当前是否开启select @@query_cache_type;#当前是否应用show variables like 'have_query_cache';#当前设置的缓存值,如果是0,则表示未开启,未应用select @@global.query_cache_size;#设置服务器的缓存值,单位是字节,1M=1048576byte,如下是设置的10M.set @@global.query_cache_size=10485760; 阅读全文

posted @ 2012-03-23 19:17 blackcore 阅读(296) 评论(0) 推荐(0)

【转】mysql 分析查找执行效率慢的SQL语句
摘要:启动Mysql时加参数--log-slow-queries来记录执行时间超过long_query_time秒的sqlMySQL 自带 slow log 的分析工具 mysqldumpslow。slow log 是 MySQL 根据 SQL 语句的执行时间设定,写入的一个文件,用于分析执行较慢的语句。只要在 my.cnf 文件中配置好: log-slow-queries = [slow_query_log_filename] 即可记录超过默认的 10s 执行时间的 SQL 语句。如果要修改默认设置,可以添加:long_query_time = 5 设定为 5s 。explain来了解SQL执行的 阅读全文

posted @ 2012-03-22 10:02 blackcore 阅读(9530) 评论(0) 推荐(0)