MySQL中查询日志与慢查询日志的基本学习教程(转)

一、查询日志

查询日志记录MySQL中所有的query,通过"--log[=file_name]"来打开该功能。由于记录了所有的query,包括所有的select,体积比较大,开启后对性能也有比较大的影响,所以请大家慎用该功能。一般只用于跟踪某些特殊的sql性能问题才会短暂打开该功能。默认的查询日志文件名为:hostname.log.  
----默认情况下查看是否启用查询日志:


1

[[email protected] mysql5.5]# service mysql start


1

Starting MySQL....                     [ OK ]


1

[[email protected] mysql5.5]# mysql


1

2

3

4

5

6

7

8

9

10

11

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


1

mysql> show variables like ‘%log‘;


1

2

3

4

5

6

7

8

9

10

11

12

13

+--------------------------------+-------+

| Variable_name         | Value |

+--------------------------------+-------+

| back_log            | 50  |

| general_log          | OFF  |

| innodb_locks_unsafe_for_binlog | OFF  |

| log              | OFF  |

| relay_log           |    |

| slow_query_log         | OFF  |

| sync_binlog          | 0   |

| sync_relay_log         | 0   |

+--------------------------------+-------+

8 rows in set (0.00 sec)


1

----备注:log和general_log这两个参数是兼容的。而默认的情况下查询日志是不开启的<br>----使用下面的命令是开启查询日志<br>mysql> set global log=1;


1

Query OK, 0 rows affected, 1 warning (0.03 sec)


1

mysql> show variables like ‘%log‘;


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

+--------------------------------+-------+

| Variable_name         | Value |

+--------------------------------+-------+

| back_log            | 50  |

| general_log          | ON  |

| innodb_locks_unsafe_for_binlog | OFF  |

| log              | ON  |

| relay_log           |    |

| slow_query_log         | OFF  |

| sync_binlog          | 0   |

| sync_relay_log         | 0   |

+--------------------------------+-------+

8 rows in set (0.00 sec)

----其中log参数是过时的,在启动选项中使用log参数的话,会在err日志中显示出来。

----修改my.cnf文件,添加log的参数设置


1

2

3

4

5

6

7

8

[[email protected] mysql5.5]# vi my.cnf

[[email protected] mysql5.5]# cat ./my.cnf |grep ‘^log=‘

log=/tmp/mysqlgen.log

----清空err日志

[[email protected] mysql5.5]# cat /dev/null > /tmp/mysql3306.err

[[email protected] mysql5.5]# ll /tmp/mysql3306.err

-rw-rw---- 1 mysql root 0 Jul 31 07:50 /tmp/mysql3306.err

[[email protected] mysql5.5]# service mysql start


1

2

Starting MySQL...                     [ OK ]

----启动数据库后查看err日志的内容


1

[[email protected] mysql5.5]# cat /tmp/mysql3306.err 


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

130731 07:51:32 mysqld_safe Starting mysqld daemon with databases from /opt/mysql5.5/data

130731 7:51:32 [Warning] The syntax ‘--log‘ is deprecated and will be removed in a future release. Please use ‘--general-log‘/‘--general-log-file‘ instead.

130731 7:51:33 InnoDB: The InnoDB memory heap is disabled

130731 7:51:33 InnoDB: Mutexes and rw_locks use InnoDB‘s own implementation

130731 7:51:33 InnoDB: Compressed tables use zlib 1.2.3

130731 7:51:33 InnoDB: Initializing buffer pool, size = 128.0M

130731 7:51:33 InnoDB: Completed initialization of buffer pool

130731 7:51:33 InnoDB: highest supported file format is Barracuda.

130731 7:51:33 InnoDB: Waiting for the background threads to start

130731 7:51:34 InnoDB: 1.1.8 started; log sequence number 1625855

130731 7:51:34 [Note] Event Scheduler: Loaded 0 events

130731 7:51:34 [Note] /opt/mysql5.5/bin/mysqld: ready for connections.

Version: ‘5.5.22-log‘ socket: ‘/tmp/mysql.sock‘ port: 3306 Source distribution

----使用最新的参数

----general_log和general_log_file。


1

[[email protected] mysql5.5]# service mysql stop


1

Shutting down MySQL.                    [ OK ]


1

2

[[email protected] mysql5.5]# vi my.cnf

[[email protected] mysql5.5]# cat ./my.cnf |grep ‘^general‘


1

2

general_log = 1

general_log_file = /tmp/mysqlgen.log


1

[[email protected] mysql5.5]# service mysql start


1

Starting MySQL...                     [ OK ]


1

[[email protected] mysql5.5]# mysql


1

2

3

4

5

6

7

8

9

10

11

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


1

mysql> show variables like ‘%log‘;


1

2

3

4

5

6

7

8

9

10

11

12

13

+--------------------------------+-------+

| Variable_name         | Value |

+--------------------------------+-------+

| back_log            | 50  |

| general_log          | ON  |

| innodb_locks_unsafe_for_binlog | OFF  |

| log              | ON  |

| relay_log           |    |

| slow_query_log         | OFF  |

| sync_binlog          | 0   |

| sync_relay_log         | 0   |

+--------------------------------+-------+

8 rows in set (0.04 sec)


1

mysql> show variables like ‘%file‘;


1

2

3

4

5

6

7

8

9

10

11

12

13

14

+---------------------+-----------------------------------+

| Variable_name    | Value               |

+---------------------+-----------------------------------+

| ft_stopword_file  | (built-in)            |

| general_log_file  | /tmp/mysqlgen.log         |

| init_file      |                  |

| local_infile    | ON                |

| pid_file      | /tmp/mysql3306.pid        |

| relay_log_info_file | relay-log.info          |

| slow_query_log_file | /opt/mysql5.5/data/node4-slow.log |

+---------------------+-----------------------------------+

7 rows in set (0.00 sec)

----在上面的操作中可以看到已经启用查询日志,并且文件目录是/tmp/mysqlgen.log。

----查询日志记录了哪些东西?

进行下面的查询


1

mysql> show databases;


1

2

3

4

5

6

7

8

9

10

+--------------------+

| Database      |

+--------------------+

| information_schema |

| mysql       |

| performance_schema |

| test        |

| test2       |

+--------------------+

5 rows in set (0.08 sec)


1

mysql> use test;


1

Database changed


1

mysql> show tables;


1

Empty set (0.00 sec)


1

mysql> use test2;


1

Database changed


1

mysql> show tables;


1

2

3

4

5

6

7

8

9

10

11

+-----------------+

| Tables_in_test2 |

+-----------------+

| course     |

| jack      |

| sc       |

| student     |

| t        |

| teacher     |

+-----------------+

6 rows in set (0.07 sec)


1

mysql> drop table t;


1

Query OK, 0 rows affected (0.13 sec)


1

mysql> select * from sc;


1

2

3

Empty set (0.04 sec)

----可以看到上面的操作都记录在了mysqlgen.log里面。


1

[[email protected] ~]# tail -f /tmp/mysqlgen.log


1

2

3

4

5

6

7

8

9

10

11

12

/opt/mysql5.5/bin/mysqld, Version: 5.5.22-log (Source distribution). started with:

Tcp port: 3306 Unix socket: /tmp/mysql.sock

Time         Id Command  Argument

130731 7:55:41    1 Query  show databases

130731 7:55:56    1 Query  SELECT DATABASE()

      1 Init DB  test

130731 7:55:59    1 Query  show tables

130731 7:56:19    1 Query  SELECT DATABASE()

      1 Init DB  test2

130731 7:56:23    1 Query  show tables

130731 7:56:27    1 Query  drop table t

130731 7:56:39    1 Query  select * from sc

二、慢查询日志
   顾名思义,慢查询日志中记录的是执行时间较长的query,也就是我们常说的slow query,通过设--log-slow-queries[=file_name]来打开该功能并设置记录位置和文件名,默认文件名为hostname-slow.log,默认目录也是数据目录。
    慢查询日志采用的是简单的文本格式,可以通过各种文本编辑器查看其中的内容。其中记录了语句执行的时刻,执行所消耗的时间,执行用户,连接主机等相关信息。MySQL还提供了专门用来分析满查询日志的工具程序mysqlslowdump,用来帮助数据库管理人员解决可能存在的性能问题。

----使用log_slow_queries参数打开慢查询,由于该参数已经过时,因此在err日志中将出现提示信息


1

2

3

4

5

6

7

----修改my.cnf文件,添加log_slow_queries参数

[[email protected] ~]# vi /opt/mysql5.5/my.cnf

[[email protected] ~]# cat /opt/mysql5.5/my.cnf |grep ‘^log_slow‘

log_slow_queries = /tmp/mysqlslow.log

----清空err日志内容:

[[email protected] ~]# cat /dev/null > /tmp/mysql3306.err

[[email protected] ~]# service mysql start


1

Starting MySQL....                     [ OK ]


1

2

3

4

----查看err日志的信息

[[email protected] data]# tail -f /tmp/mysql3306.err


1

2

3

4

5

6

7

8

9

10

11

12

13

14

02:26:28 mysqld_safe Starting mysqld daemon with databases from /opt/mysql5.5/data

 2:26:28 [Warning] The syntax ‘--log-slow-queries‘ is deprecated and will be removed in a future release. Please use ‘--slow-query-log‘/‘--slow-query-log-file‘ instead.

 2:26:28 [Warning] You need to use --log-bin to make --binlog-format work.

 2:26:28 InnoDB: The InnoDB memory heap is disabled

 2:26:28 InnoDB: Mutexes and rw_locks use InnoDB‘s own implementation

 2:26:28 InnoDB: Compressed tables use zlib 1.2.3

 2:26:28 InnoDB: Initializing buffer pool, size = 128.0M

 2:26:28 InnoDB: Completed initialization of buffer pool

 2:26:28 InnoDB: highest supported file format is Barracuda.

 2:26:28 InnoDB: Waiting for the background threads to start

 2:26:30 InnoDB: 1.1.8 started; log sequence number 3069452

 2:26:30 [Note] Event Scheduler: Loaded 0 events

 2:26:30 [Note] /opt/mysql5.5/bin/mysqld: ready for connections.

Version: ‘5.5.22-log‘ socket: ‘/tmp/mysql.sock‘ port: 3306 Source distribution


1

2

3

----使用slow_query_log和slow_query_log_file

[[email protected] ~]# vi /opt/mysql5.5/my.cnf

[[email protected] ~]# cat /opt/mysql5.5/my.cnf |grep ‘^slow_query‘

?


1

2

slow_query_log = 1

slow_query_log_file = /tmp/mysqlslow.log1


1

[[email protected] ~]# service mysql start


1

Starting MySQL...                     [ OK ]


1

[[email protected] ~]# mysql


1

2

3

4

5

6

7

8

9

10

11

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


1

mysql> show variables like ‘%slow%‘;


1

2

3

4

5

6

7

8

9

+---------------------+---------------------+

| Variable_name    | Value        |

+---------------------+---------------------+

| log_slow_queries  | ON         |

| slow_launch_time  | 10          |

| slow_query_log   | ON         |

| slow_query_log_file | /tmp/mysqlslow.log1 |

+---------------------+---------------------+

rows in set (0.00 sec)


1

2

----关于slow_launch_time参数,首先修改一下参数值

mysql> set global long_query_time=1;


1

Query OK, 0 rows affected (0.00 sec)


1

mysql> show variables like ‘%long_query%‘;


1

2

3

4

5

6

+-----------------+----------+

| Variable_name  | Value  |

+-----------------+----------+

| long_query_time | 1.000000 |

+-----------------+----------+

row in set (0.00 sec)

----进行一下相关操作,查看/tmp/mysqlslow.log1的内容


1

mysql> select database();


1

2

3

4

5

6

+------------+

| database() |

+------------+

| NULL    |

+------------+

row in set (0.00 sec)


1

mysql> use test;


1

Database changed


1

mysql> show tables;


1

Empty set (0.00 sec)


1

mysql> create table t as select * from information_schema.tables;


1

2

Query OK, 85 rows affected (0.38 sec)

Records: 85 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

Query OK, 85 rows affected (0.05 sec)

Records: 85 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

Query OK, 170 rows affected (0.03 sec)

Records: 170 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

Query OK, 340 rows affected (0.05 sec)

Records: 340 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

Query OK, 680 rows affected (0.08 sec)

Records: 680 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

Query OK, 1360 rows affected (0.29 sec)

Records: 1360 Duplicates: 0 Warnings: 0


1

mysql> insert into t select * from t;


1

2

3

4

Query OK, 2720 rows affected (1.49 sec)

Records: 2720 Duplicates: 0 Warnings: 0

----在这里已经超过1s了,查看/tmp/mysqlslow.log1


1

[[email protected] data]# tail -f /tmp/mysqlslow.log1


1

2

3

4

5

6

7

8

# Time: 130801 2:36:25

# [email protected]: root[root] @ localhost []

# Query_time: 2.274219 Lock_time: 0.000322 Rows_sent: 0 Rows_examined: 5440

use test;

SET timestamp=1375295785;

insert into t select * from t;

----log_queries_not_using_indexes参数实验


1

mysql> show variables like ‘%indexes%‘;


1

2

3

4

5

6

+-------------------------------+-------+

| Variable_name         | Value |

+-------------------------------+-------+

| log_queries_not_using_indexes | OFF  |

+-------------------------------+-------+

row in set (0.00 sec)


1

mysql> set log_queries_not_using_indexes = 1;


1

ERROR 1229 (HY000): Variable ‘log_queries_not_using_indexes‘ is a GLOBAL variable and should be set with SET GLOBAL


1

mysql> set global log_queries_not_using_indexes = 1;


1

Query OK, 0 rows affected (0.01 sec)


1

mysql> show variables like ‘%indexes%‘;


1

2

3

4

5

6

+-------------------------------+-------+

| Variable_name         | Value |

+-------------------------------+-------+

| log_queries_not_using_indexes | ON  |

+-------------------------------+-------+

row in set (0.00 sec)


1

mysql> desc t;


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

+-----------------+---------------------+------+-----+---------+-------+

| Field      | Type        | Null | Key | Default | Extra |

+-----------------+---------------------+------+-----+---------+-------+

| TABLE_CATALOG  | varchar(512)    | NO  |   |     |    |

| TABLE_SCHEMA  | varchar(64)     | NO  |   |     |    |

| TABLE_NAME   | varchar(64)     | NO  |   |     |    |

| TABLE_TYPE   | varchar(64)     | NO  |   |     |    |

| ENGINE     | varchar(64)     | YES |   | NULL  |    |

| VERSION     | bigint(21) unsigned | YES |   | NULL  |    |

| ROW_FORMAT   | varchar(10)     | YES |   | NULL  |    |

| TABLE_ROWS   | bigint(21) unsigned | YES |   | NULL  |    |

| AVG_ROW_LENGTH | bigint(21) unsigned | YES |   | NULL  |    |

| DATA_LENGTH   | bigint(21) unsigned | YES |   | NULL  |    |

| MAX_DATA_LENGTH | bigint(21) unsigned | YES |   | NULL  |    |

| INDEX_LENGTH  | bigint(21) unsigned | YES |   | NULL  |    |

| DATA_FREE    | bigint(21) unsigned | YES |   | NULL  |    |

| AUTO_INCREMENT | bigint(21) unsigned | YES |   | NULL  |    |

| CREATE_TIME   | datetime      | YES |   | NULL  |    |

| UPDATE_TIME   | datetime      | YES |   | NULL  |    |

| CHECK_TIME   | datetime      | YES |   | NULL  |    |

| TABLE_COLLATION | varchar(32)     | YES |   | NULL  |    |

| CHECKSUM    | bigint(21) unsigned | YES |   | NULL  |    |

| CREATE_OPTIONS | varchar(255)    | YES |   | NULL  |    |

| TABLE_COMMENT  | varchar(2048)    | NO  |   |     |    |

+-----------------+---------------------+------+-----+---------+-------+

rows in set (0.05 sec)


1

2

----下面的命令是查看索引的

mysql> show index from t;


1

Empty set (0.01 sec)


1

mysql> select * from t where engine=‘xxx‘;


1

2

3

4

5

6

7

Empty set (0.18 sec)

# Time: 130801 2:43:43

# [email protected]: root[root] @ localhost []

# Query_time: 0.185773 Lock_time: 0.148868 Rows_sent: 0 Rows_examined: 5440

SET timestamp=1375296223;

select * from t where engine=‘xxx‘;

PS:slow query log相关变量

命令行参数:

--log-slow-queries

指定日志文件存放位置,可以为空,系统会给一个缺省的文件host_name-slow.log

系统变量

log_slow_queries

指定日志文件存放位置,可以为空,系统会给一个缺省的文件host_name-slow.log

slow_query_log

slow quere log的开关,当值为1的时候说明开启慢查询。

slow_query_log_file

指定日志文件存放位置,可以为空,系统会给一个缺省的文件host_name-slow.log

long_query_time

记录超过的时间,默认为10s

log_queries_not_using_indexes

log下来没有使用索引的query,可以根据情况决定是否开启

三、Mysqldumpslow

如果日志内容很多,用眼睛一条一条看会累死,mysql自带了分析的工具,使用方法如下:


1

[[email protected] data]# mysqldumpslow --help


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]

Parse and summarize the MySQL slow query log. Options are

 --verbose  verbose

 --debug   debug

 --help    write this text to standard output

 -v      verbose

 -d      debug

 -s ORDER   what to sort by (al, at, ar, c, l, r, t), ‘at‘ is default

        al: average lock time

        ar: average rows sent

        at: average query time

         c: count

         l: lock time

         r: rows sent

         t: query time

 -r      reverse the sort order (largest last instead of first)

 -t NUM    just show the top n queries

 -a      don‘t abstract all numbers to N and strings to ‘S‘

 -n NUM    abstract numbers with at least n digits within names

 -g PATTERN  grep: only consider stmts that include this string

 -h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard),

        default is ‘*‘, i.e. match all

 -i NAME   name of server instance (if using mysql.server startup script)

 -l      don‘t subtract lock time from total time

原文地址:https://www.cnblogs.com/wuwuw/p/8855889.html

时间: 2024-10-11 18:26:51

MySQL中查询日志与慢查询日志的基本学习教程(转)的相关文章

mysql中使用show variables同时查询多个参数值?show variables的使用?

需求描述: 今天在查mysq关于连接数的问题,想要通过一个show variables命令同时查出来多个值.在此记录下. 操作过程: 1.通过show variables语句的like可以匹配多个值或者某个值 mysql> show variables like 'max_connections'; #这里默认的就是对Variable_name进行匹配,这里是准确匹配. +-----------------+-------+ | Variable_name | Value | +--------

mysql中如何开启binlog?开启二进制日志文件?binary log?

需求描述: 开启mysql的binlog即binary log日志功能,在此记录下. 版本描述: mysql版本:5.7.21-log 操作过程: 1.修改my.cnf并且将以下参数加入其中,重启mysql实例 server-id=11 #由于bug,所以需要设置该参数.否则无法启动mysql实例 log-bin = mysql-bin #其中mysql-bin代表的是basename就是生成二进制日志文件的前缀部分,默认的位置在datadir目录下,也可以设置为其他的路径 2.查看binlog

mysql中一库多表查询主键

mysql> show databases; mysql> use information_schema; mysql> show tables; mysql> select * from KEY_COLUMN_USAGE;    //这一步是查询每个库里每个表的信息 mysql> select * from KEY_COLUMN_USAGE where TABLE_SCHEMA='table_name' and CONSTRAINT_NAME='PRIMARY';  //根

MySQL中的?加关键字查询命令用法

1.查询MySQL支持的数据类型 "? data types;" 2.查看int的用法"? int" 3.查看show的用法"? show" 4.查看创建数据库表语句的用法"? create table" 版权声明:本文为博主原创文章,未经博主允许不得转载.

MySql中根据一列状态值查询状态的个数

最近搞报表的项目,要写数据库sql语句,根据状态值查询状态的个数,这个开始难为到我了,不过已经有解决办法了. 在数据库表中有一个字段是状态(zt),这里面有1-7这7个状态,现在查询每个状态的数量,并且显示在一张表中,正常情况下查状态是: SELECT COUNT(*) draft  FROM `it_project_info` WHERE `it_project_info`.item_status`='1'; SELECT COUNT(*) checks FROM `it_project_in

mysql中delete from in子查询删除失败

遇到一个情况,想通过表1的id找到表2,删除表2中barcode关联的库存数据,然后一直不能失败,如下: delete from 库存表 where BARCODE in( select BARCODE from 表1 where fmoveid= (select id from 表2 where PCID='SMX2014082604494930') ); 解决方式,加别名 delete from 库存表 where BARCODE in( select aa.BARCODE from(   

Mysql中实现多表关联查询更新操作

今天一下要记录一下才行了,每次都要去网上查找方法,每次都难找得要命 Mysql在更新某些字段的数据时,有时候会依据其他表的数据进行更新,需要通过关联后对不同的行更新不同的值,传统的update set没法实现,可以用下面的方法来实现 UPDATE `widetable_solr_field` a INNER JOIN `widetable_field_increat` b SET a.`compose` = b.`udf` WHERE a.`fname` = CONCAT('t',b.`tabl

MySQL中IN (字符串)查询

方法一: SELECT Z.ZONE_ID,Z.NAME,Z.CODE,Z.OTHER_NAME FROM T_SYS_ZONE Z WHERE CONCAT(','(SELECT ZI.INCHARGE_ZONE FROM T_CRM_SALES_INCHARGE_ZONE ZI WHERE Z.SALES_MEN=7),',') 方法二: SELECT Z.ZONE_ID,Z.NAME,Z.CODE,Z.OTHER_NAME FROM T_SYS_ZONE Z WHERE FIND_IN_S

Mysql 中的日期时间字符串查询

一. DATE_FORMAT (date, format)能根据格式串format 格式化日期或日期和时间值date,返回结果串.可用DATE_FORMAT( ) 来格式化DATE 或DATETIME 值,以便得到所希望的格式.根据format字符串格式化 STR_TO_DATE(str,format) 将制定日期格式字符串时间表达式转化为 DTAE类型 原文地址:https://www.cnblogs.com/shiqi17/p/10710028.html

MySQL5.6 如何优化慢查询的SQL语句 -- 慢日志介绍

最近有个开发团队抱怨我们平台包含的mysql cluster不行,总是报mysql的"heartbeat Error",分析了他们收集的日志,没有发现mysql cluster节点之间的网络有问题,倒是发现了一个很有意思的现象,在mysql的slow log里面发现了大量的慢查询,基本上都是要1秒钟以上,很明显这种耗时高的慢查询会影响系统行为,指出这点让开发团队去优化他们的应用,很好奇他们竟然不知道有这些东西可以分析...... 数据库响应慢问题最多的就是查询了.现在大部分数据库都提供