Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20241002] MySQL Explain (TRADITIONAL, TREE, JSON, ANALYZE) #276

Open
JuHyun419 opened this issue Oct 2, 2024 · 0 comments
Open

[20241002] MySQL Explain (TRADITIONAL, TREE, JSON, ANALYZE) #276

JuHyun419 opened this issue Oct 2, 2024 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

JuHyun419 commented Oct 2, 2024

SELECT * FROM 사원 WHERE 사원번호 BETWEEN 100001 AND 200000;

EXPLAIN (default TRADITIONAL)
image


EXPLAIN FORMAT = TREE

-> Filter: (`사원`.`사원번호` between 100001 and 200000)  (cost=4021.24 rows=20080)
    -> Index range scan on 사원 using PRIMARY over (100001 <= 사원번호 <= 200000)  (cost=4021.24 rows=20080)

EXPLAIN FORMAT = JSON

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "4021.24"
    },
    "table": {
      "table_name": "사원",
      "access_type": "range",
      "possible_keys": [
        "PRIMARY"
      ],
      "key": "PRIMARY",
      "used_key_parts": [
        "사원번호"
      ],
      "key_length": "4",
      "rows_examined_per_scan": 20080,
      "rows_produced_per_join": 20080,
      "filtered": "100.00",
      "cost_info": {
        "read_cost": "2013.24",
        "eval_cost": "2008.00",
        "prefix_cost": "4021.24",
        "data_read_per_join": "1M"
      },
      "used_columns": [
        "사원번호",
        "생년월일",
        "이름",
        "",
        "성별",
        "입사일자"
      ],
      "attached_condition": "(`tuning`.`사원`.`사원번호` between 100001 and 200000)"
    }
  }
}

EXPLAIN ANALYZE

-> Filter: (`사원`.`사원번호` between 100001 and 200000)  (cost=4021.24 rows=20080) (actual time=0.086..10.034 rows=10025 loops=1)
    -> Index range scan on 사원 using PRIMARY over (100001 <= 사원번호 <= 200000)  (cost=4021.24 rows=20080) (actual time=0.079..8.449 rows=10025 loops=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant