Code Monkey home page Code Monkey logo

Comments (5)

samdark avatar samdark commented on July 19, 2024

Please elaborate.

from yii2-debug.

lichunqiang avatar lichunqiang commented on July 19, 2024

Sorry for that.

Now, the yii\debug\actions\db\ExplainAction, executed this to fetch explain result:

https://github.com/yiisoft/yii2-debug/blob/master/actions%2Fdb%2FExplainAction.php#L30

This can only query one result, but generally, there are not just one.

Why not query out all result of explain?

from yii2-debug.

samdark avatar samdark commented on July 19, 2024

Are you sure it returns multiple rows?

from yii2-debug.

lichunqiang avatar lichunqiang commented on July 19, 2024

Yes. if there is.

$query = 'SELECT * FROM qa_question LEFT JOIN qa_answer ON qa_answer.question_id = qa_question.id';
$result = Yii::$app->getDb()->createCommand('EXPLAIN ' . $query)->queryAll();

var_dump($result);
array (size=2)
  0 => 
    array (size=10)
      'id' => string '1' (length=1)
      'select_type' => string 'SIMPLE' (length=6)
      'table' => string 'qa_question' (length=11)
      'type' => string 'ALL' (length=3)
      'possible_keys' => null
      'key' => null
      'key_len' => null
      'ref' => null
      'rows' => string '649' (length=3)
      'Extra' => null
  1 => 
    array (size=10)
      'id' => string '1' (length=1)
      'select_type' => string 'SIMPLE' (length=6)
      'table' => string 'qa_answer' (length=9)
      'type' => string 'ref' (length=3)
      'possible_keys' => string 'idx_q' (length=5)
      'key' => string 'idx_q' (length=5)
      'key_len' => string '4' (length=1)
      'ref' => string 'lxpgw_0828.qa_question.id' (length=25)
      'rows' => string '1' (length=1)
      'Extra' => string 'Using where' (length=11)

from yii2-debug.

samdark avatar samdark commented on July 19, 2024

Then it's a bug...

from yii2-debug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.