分析SQL执行带来的开销是优化SQL的重要手段。在MySQL数据库中,可以通过配置profiling参数来启用SQL剖析。该参数可以在全局和session级别来设置。对于全局级别则作用于整个MySQL实例,而session级别紧影响当前session。该参数开启后,后续执行的SQL语句都将记录其资源开销,诸如IO,上下文切换,CPU,Memory等等。根据这些开销进一步分析当前SQL瓶颈从而进行优化与调整。

1.有关profile的解释
--当前版本
mysql> show variables like 'version';
+---------------+------------+
| Variable_name | Value |
+---------------+------------+
| version | 5.5.29-log |
+---------------+------------+ --查看profiling系统变量
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| profiling | OFF | --开启SQL语句剖析功能。0或OFF表示关闭(默认模式)。1或ON表示开启
| profiling_history_size | 15 | --设置保留profiling的数目,缺省为15,范围为0至100,为0时将禁用profiling。这个参数在MySQL 5.6.8过期,在后期版本中会被移除。
+------------------------+-------+ 如果将profiling_history_size参数设置为0,同样具有关闭MySQL的profiling效果。 --获取profile的帮助
mysql> help profile;
Name: 'SHOW PROFILE'
Description:
Syntax:
SHOW PROFILE [type [, type] ... ]
[FOR QUERY n] --如果不指定,只是显示最近执行的语句;如果指定会显示语句n,n对应query_id的值
[LIMIT row_count [OFFSET offset]] type:
ALL --显示所有的开销信息
| BLOCK IO --显示块IO相关开销
| CONTEXT SWITCHES --上下文切换相关开销
| CPU --显示CPU相关开销信息
| IPC --显示发送和接收相关开销信息
| MEMORY --显示内存相关开销信息
| PAGE FAULTS --显示页面错误相关开销信息
| SOURCE --显示和Source_function,Source_file,Source_line相关的开销信息
| SWAPS --显示交换次数相关开销的信息 Profiling由会话级别参数profiling控制。缺省是显示状态和持续时间。
上面描述从5.6.7开始该命令将会被移除,用Performance Schema instead代替 2、开启porfiling --启用session级别的profiling
mysql> set profiling=1;
Query OK, 0 rows affected, 1 warning (0.00 sec) --验证修改后的结果
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| profiling | ON |
| profiling_history_size | 15 |
+------------------------+-------+ --执行SQL查询
mysql> show databases;
mysql> show tables;
mysql> select count(*) from emp --查看当前session所有已产生的profile
mysql> show profiles;
+----------+------------+-------------------------------------------------------+
| Query_ID | Duration | Query |
--------------------------------------------------------------------------------+
| 1 | 0.00037700 | show variables like '%profil%' |
| 2 | 0.00029500 | show databases |
| 3 | 0.00030800 | show tables |
| 4 | 0.00135700 | select count(*) from emp
+----------+------------+-------------------------------------------------------+ 3、获取SQL语句的开销信息 --可以直接使用show profile来查看上一条SQL语句的开销信息
--注,show profile之类的语句不会被profiling,即自身不会产生Profiling
mysql> show profile;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ --显示所有性能信息
mysql> show profile all for query 9;
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+
| Status | Duration | CPU_user | CPU_system | Context_voluntary | Context_involuntary | Block_ops_in | Block_ops_out | Messages_sent | Messages_received | Page_faults_major | Page_faults_minor | Swaps | Source_function | Source_file | Source_line |
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+
| starting | 0.000997 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | NULL | NULL | NULL |
| Opening tables | 0.000015 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_base.cc | 4622 |
| System lock | 0.000003 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | lock.cc | 260 |
| Table lock | 0.000515 | 0.001000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | lock.cc | 271 |
| optimizing | 0.000093 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 835 |
| statistics | 0.151343 | 0.124981 | 0.023996 | 1 | 155 | 0 | 0 | 0 | 0 | 0 | 39 | 0 | unknown function | sql_select.cc | 1026 |
| preparing | 0.000082 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1048 |
| executing | 0.000027 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1789 |
| Sending data | 0.081436 | 0.072989 | 0.006999 | 0 | 82 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2347 |
| init | 0.000024 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2537 |
| optimizing | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 835 |
| statistics | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1026 |
| preparing | 0.000007 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1048 |
| executing | 0.000005 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1789 |
| Sending data | 0.000046 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2347 |
| end | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2583 |
| query end | 0.000003 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 5123 |
| freeing items | 0.000076 | 0.001000 | 0.000000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 6147 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 10929 |
| closing tables | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 10954 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 1735 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 1703 |
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+ --获取指定查询的开销
mysql> show profile for query 9;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ mysql> show profile for query 9 limit 3;
+----------------+----------+
| Status | Duration |
+----------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
+----------------+----------+ mysql> show profile for query 9 limit 3 offset 5;
+------------+----------+
| Status | Duration |
+------------+----------+
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
+------------+----------+ --查看特定部分的开销,如下为CPU部分的开销
mysql> show profile cpu for query 9;
+--------------------+----------+----------+------------+
| Status | Duration | CPU_user | CPU_system |
+--------------------+----------+----------+------------+
| starting | 0.000997 | 0.000000 | 0.000000 |
| Opening tables | 0.000015 | 0.000000 | 0.000000 |
| System lock | 0.000003 | 0.000000 | 0.000000 |
| Table lock | 0.000515 | 0.001000 | 0.000000 |
| optimizing | 0.000093 | 0.000000 | 0.000000 |
| statistics | 0.151343 | 0.124981 | 0.023996 |
| preparing | 0.000082 | 0.000000 | 0.000000 |
| executing | 0.000027 | 0.000000 | 0.000000 |
| Sending data | 0.081436 | 0.072989 | 0.006999 |
| init | 0.000024 | 0.000000 | 0.000000 |
| optimizing | 0.000006 | 0.000000 | 0.000000 |
| statistics | 0.000006 | 0.000000 | 0.000000 |
| preparing | 0.000007 | 0.000000 | 0.000000 |
| executing | 0.000005 | 0.000000 | 0.000000 |
| Sending data | 0.000046 | 0.000000 | 0.000000 |
| end | 0.000004 | 0.000000 | 0.000000 |
| query end | 0.000003 | 0.000000 | 0.000000 |
| freeing items | 0.000076 | 0.001000 | 0.000000 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 |
| closing tables | 0.000004 | 0.000000 | 0.000000 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 |
+--------------------+----------+----------+------------+ --如下为MEMORY部分的开销
mysql> show profile memory for query 9 ;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ --同时查看不同资源开销
mysql> show profile block io,cpu for query 9;
+--------------------+----------+----------+------------+--------------+---------------+
| Status | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |
+--------------------+----------+----------+------------+--------------+---------------+
| starting | 0.000997 | 0.000000 | 0.000000 | 0 | 0 |
| Opening tables | 0.000015 | 0.000000 | 0.000000 | 0 | 0 |
| System lock | 0.000003 | 0.000000 | 0.000000 | 0 | 0 |
| Table lock | 0.000515 | 0.001000 | 0.000000 | 0 | 0 |
| optimizing | 0.000093 | 0.000000 | 0.000000 | 0 | 0 |
| statistics | 0.151343 | 0.124981 | 0.023996 | 0 | 0 |
| preparing | 0.000082 | 0.000000 | 0.000000 | 0 | 0 |
| executing | 0.000027 | 0.000000 | 0.000000 | 0 | 0 |
| Sending data | 0.081436 | 0.072989 | 0.006999 | 0 | 0 |
| init | 0.000024 | 0.000000 | 0.000000 | 0 | 0 |
| optimizing | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| statistics | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| preparing | 0.000007 | 0.000000 | 0.000000 | 0 | 0 |
| executing | 0.000005 | 0.000000 | 0.000000 | 0 | 0 |
| Sending data | 0.000046 | 0.000000 | 0.000000 | 0 | 0 |
| end | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
| query end | 0.000003 | 0.000000 | 0.000000 | 0 | 0 |
| freeing items | 0.000076 | 0.001000 | 0.000000 | 0 | 0 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| closing tables | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 | 0 | 0 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
+--------------------+----------+----------+------------+--------------+---------------+ --显示swap的次数。
mysql> show profile swaps for query 9;
+--------------------+----------+-------+
| Status | Duration | Swaps |
+--------------------+----------+-------+
| starting | 0.000997 | 0 |
| Opening tables | 0.000015 | 0 |
| System lock | 0.000003 | 0 |
| Table lock | 0.000515 | 0 |
| optimizing | 0.000093 | 0 |
| statistics | 0.151343 | 0 |
| preparing | 0.000082 | 0 |
| executing | 0.000027 | 0 |
| Sending data | 0.081436 | 0 |
| init | 0.000024 | 0 |
| optimizing | 0.000006 | 0 |
| statistics | 0.000006 | 0 |
| preparing | 0.000007 | 0 |
| executing | 0.000005 | 0 |
| Sending data | 0.000046 | 0 |
| end | 0.000004 | 0 |
| query end | 0.000003 | 0 |
| freeing items | 0.000076 | 0 |
| removing tmp table | 0.000006 | 0 |
| closing tables | 0.000004 | 0 |
| logging slow query | 0.000002 | 0 |
| cleaning up | 0.000004 | 0 |
+--------------------+----------+-------+ --下面的SQL语句用于查询query_id为9的SQL开销,且按最大耗用时间倒序排列
mysql> set @query_id=9; mysql> SELECT STATE,
-> SUM(DURATION) AS Total_R,
-> ROUND(100 * SUM(DURATION) /
-> (SELECT SUM(DURATION)
-> FROM INFORMATION_SCHEMA.PROFILING
-> WHERE QUERY_ID = @query_id),
-> 2) AS Pct_R,
-> COUNT(*) AS Calls,
-> SUM(DURATION) / COUNT(*) AS "R/Call"
-> FROM INFORMATION_SCHEMA.PROFILING
-> WHERE QUERY_ID = @query_id
-> GROUP BY STATE
-> ORDER BY Total_R DESC;
+--------------------+----------+-------+-------+--------------+
| STATE | Total_R | Pct_R | Calls | R/Call |
+--------------------+----------+-------+-------+--------------+
| statistics | 0.151349 | 64.49 | 2 | 0.0756745000 |--最大耗用时间部分为statistics
| Sending data | 0.081482 | 34.72 | 2 | 0.0407410000 |
| starting | 0.000997 | 0.42 | 1 | 0.0009970000 |
| Table lock | 0.000515 | 0.22 | 1 | 0.0005150000 |
| optimizing | 0.000099 | 0.04 | 2 | 0.0000495000 |
| preparing | 0.000089 | 0.04 | 2 | 0.0000445000 |
| freeing items | 0.000076 | 0.03 | 1 | 0.0000760000 |
| executing | 0.000032 | 0.01 | 2 | 0.0000160000 |
| init | 0.000024 | 0.01 | 1 | 0.0000240000 |
| Opening tables | 0.000015 | 0.01 | 1 | 0.0000150000 |
| removing tmp table | 0.000006 | 0.00 | 1 | 0.0000060000 |
| cleaning up | 0.000004 | 0.00 | 1 | 0.0000040000 |
| end | 0.000004 | 0.00 | 1 | 0.0000040000 |
| closing tables | 0.000004 | 0.00 | 1 | 0.0000040000 |
| query end | 0.000003 | 0.00 | 1 | 0.0000030000 |
| System lock | 0.000003 | 0.00 | 1 | 0.0000030000 |
| logging slow query | 0.000002 | 0.00 | 1 | 0.0000020000 |
+--------------------+----------+-------+-------+--------------+ --开启profiling后,我们可以通过show profile等方式查看,其实质是这些开销信息被记录到information_schema.profiling表
--如下面的查询,部分信息省略
mysql> select * from profiling limit 3,3\G;
*************************** 1. row ***************************
QUERY_ID: 2
SEQ: 4
STATE: Table lock
DURATION: 0.000007
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: lock.cc
SOURCE_LINE: 271
*************************** 2. row ***************************
QUERY_ID: 2
SEQ: 5
STATE: init
DURATION: 0.000010
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: sql_select.cc
SOURCE_LINE: 2537
*************************** 3. row ***************************
QUERY_ID: 2
SEQ: 6
STATE: optimizing
DURATION: 0.000003
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: sql_select.cc
SOURCE_LINE: 835
3 rows in set (0.00 sec) ERROR:
No query specified mysql> --停止profile,可以设置profiling参数,或者在session退出之后,profiling会被自动关闭
mysql> set profiling=off;
Query OK, 0 rows affected, 1 warning (0.00 sec)

MySQL-profiling的使用的更多相关文章

  1. MySQL Profiling 的使用

    MySQL Profiling 的使用 在本章第一节中我们还提到过通过 Query Profiler 来定位一条 Query 的性能瓶颈,这里我们再详细介绍一下 Profiling 的用途及使用方法. ...

  2. 使用mysql profiling功能剖析单条查询

    5.1版本开始引入show profile剖析单条语句功能,支持show profiles和show profile语句,参数have_profiling;控制是否开启: 查看是否支持这个功能(查询为 ...

  3. 如何使用mysql profiling功能分析单条查询语句

    Mysql从5.1版本开始引入show profile来剖析单条语句功能 一. 查看是否支持这个功能 yes表示支持 mysql> show variables like 'have_profi ...

  4. 【Mysql优化】MySQL Profiling 的使用

    要想优化一条 Query,我们就需要清楚的知道这条 Query 的性能瓶颈到底在哪里,是消耗的 CPU计算太多,还是需要的的 IO 操作太多?要想能够清楚的了解这些信息,在 MySQL 5.0 和 M ...

  5. MySQL – optimizer_search_depth

    Working on customer case today I ran into interesting problem – query joining about 20 tables (thank ...

  6. MySQL 优化实施方案

    1.1 前言 在进行MySQL的优化之前必须要了解的就是MySQL的查询过程,很多的查询优化工作实际上就是遵循一些原则让MySQL的优化器能够按照预想的合理方式运行而已.更多关于MySQL查询相关参照 ...

  7. Linux云计算运维-MySQL

    0.建初心 优秀DBA的素质 1.人品,不做某些事情2.严谨,运行命令前深思熟虑,三思而后行,即使是依据select3.细心,严格按照步骤一步一步执行,减少出错4.心态,遇到灾难,首先要稳住,不慌张, ...

  8. 大佬是怎么思考设计MySQL优化方案的?

    在进行MySQL的优化之前,必须要了解的就是MySQL的查询过程,很多查询优化工作实际上就是遵循一些原则,让MySQL的优化器能够按照预想的合理方式运行而已. 一.优化的哲学 注:优化有风险,涉足需谨 ...

  9. MySQL 高性能优化实战总结

    1 前言 2 优化的哲学 3 优化思路 3.1 优化什么 3.2 优化的范围有哪些 3.3 优化维度 4 优化工具有啥? 4.1 数据库层面 4.2 数据库层面问题解决思路 4.3 系统层面 4.4 ...

  10. 大牛是怎么思考设计MySQL优化方案

    在进行MySQL的优化之前,必须要了解的就是MySQL的查询过程,很多查询优化工作实际上就是遵循一些原则,让MySQL的优化器能够按照预想的合理方式运行而已. 1.优化的哲学 注:优化有风险,涉足需谨 ...

随机推荐

  1. Javascript 笔记与总结(2-1)Javascript 与 DOM

    浏览器有渲染 html 的功能,把 html 源码在内存里形成一个 DOM 对象,就是文档对象. 浏览器内部有一个 js 的解释器 / 执行器 / 引擎,如 Chrome 的 V8 引擎. 在 htm ...

  2. Javascript 笔记与总结(1-2)词法分析

    词法分析,按顺序分析 3 样: 第 1 步:先分析参数 第 2 步:再分析变量声明 第 3 步:再分析函数声明 一个函数能使用的局部变量,就从上面 3 步分析而来. 具体步骤: 0:函数运行前的瞬间, ...

  3. CentOS 6 RPM安裝python 2.7

    先说第一种方法,通过rpmbuild编译XXX.src.rpm包([1].[2]): 安装依赖:sudo yum install -y make autoconf bzip2-devel db4-de ...

  4. 每个配置xml的含义作用

    参考链接 web.xml xxx-servlet.xml(例如:dispatcher-servlet.xml)是Spring MVC里的,控制器,拦截url,转发view,对应的是controller ...

  5. [转]百度MP3音乐API接口及应用

    当你在百度去搜索一首歌时,你会发现有种更简单的方法,嘿嘿,告诉你个秘密,百度有个不公开的API http://box.zhangmen.baidu.com/x?op=12&count=1&am ...

  6. BLE GATT规范中关于UUID与属性的详细解析

    1. 角色 除了GAP定义了角色之外,BLE还定义了另外2种角色:GATT服务器和GATT客户端,它们完全独立于GAP的角色.提供数据的设备称为GATT服务器,访问GATT服务器而获得数据的设备称为G ...

  7. centos的vi常用用法

    centos的vi常用用法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...

  8. SQL Server批量数据导出导入Bulk Insert使用

    简介 Bulk insert命令区别于BCP命令之处在于它是SQL server脚本语句,它可以将本地或远程的文件数据批量导入数据库,速度非常之快:远程文件必须共享才行, 文件路径须使用通用约定(UN ...

  9. Python 扫面文件夹中的文件

    #coding=utf-8 import os,sys reload(sys) sys.setdefaultencoding("utf-8") def scan_files_sub ...

  10. C# 判断字符串是否为日期格式

    判断字符串内容是否为日期格式,并返回一个日期变量 string str; DateTime dtTime; if (DateTime.TryParse(str, out dtTime)) { //st ...