niusouti.com

Consider the query:Mysql> SET @run = 15;Mysql> EXPLAIN SELECT objective, stage, COUNT (stage)FROM iteminformationWHERE run=@run AND objective=’7.1’GROUP BY objective,stageORDER BY stage;The iteminformation table has the following indexes;Mysql> SHOW INDEX

题目

Consider the query:Mysql> SET @run = 15;Mysql> EXPLAIN SELECT objective, stage, COUNT (stage)FROM iteminformationWHERE run=@run AND objective=’7.1’GROUP BY objective,stageORDER BY stage;The iteminformation table has the following indexes;Mysql> SHOW INDEXES FROM iteminformation:This query is run several times in an application with different values in the WHERE clause in a growing data set.What is the primary improvement that can be made for this scenario?()

A.Do not pass a user variable in the WHERE clause because it limits the ability of the optimizer to use indexes

B.Add an index on the objective column so that is can be used in both the WHERE and GROUP BY operations

C.Drop the run_2 index because it has caused a conflict in the choice of key for this query

D.Execute the run_2 index because it has caused a conflict in the choice of key for this query

E.Add a composite index on (run,objective,stage) to allow the query to fully utilize an index


相似考题
参考答案和解析
参考答案:E
更多“Consider the query:Mysql> SET @run = 15;Mysql> EXPLAIN SELECT objective, stage, COUNT (sta ”相关问题
  • 第1题:

    php哪个函数用于向mysql数据库发送指令?()

    A.mysql_select_db

    B.mysql_connect

    C.mysql_query

    D.mysql_fetch_field


    参考答案:C

  • 第2题:

    在MySQL中,除了可以使用SET语句为变量赋值外,还可以通过SELECT…INTO为一个或多个变量赋值。


    正确

  • 第3题:

    连接mysql数据库服务器的函数是什么?

    A.mysqli_connect()

    B.mysqli_query()

    C.mysqli_error()

    D.mysqli_select_db()


    mysqli_connect()

  • 第4题:

    1、设置MySQL字符集的方法

    A.修改my.ini配置文件,可修改MySQL默认的字符集。###SXB###B.MySQL提供MySQL命令可以“临时地”修改MySQL“当前会话的”字符集以及字符序。###SXB###C.使用MySQL命令 “set names gbk;”可以“临时一次性地”设置character_set_client、character_set_connection以及character_set_results的字符集为gbk###SXB###D.连接MySQL服务器时指定字符集 mysql --default-character-set=字符集 -h 服务器IP地址 -u 账户名 –p密码
    A

  • 第5题:

    PHP中,选定某个数据库的函数名是____。

    A.mysql_connect_db

    B.mysql_select_db

    C.mysql_query_db

    D.mysql_pconnect_db


    mysql_select_db