File: opt_costmodel_myisam.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (71 lines) | stat: -rw-r--r-- 1,886 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Bug#23508576 FILL_INDEXES_FROM_DD() DOES NOT INITIALIZE
#              ST_KEY::M_IN_MEMORY_ESTIMATE
#
UPDATE mysql.engine_cost
SET cost_value=0.5
WHERE cost_name="memory_block_read_cost";
UPDATE mysql.engine_cost
SET cost_value=2
WHERE cost_name="io_block_read_cost";
FLUSH OPTIMIZER_COSTS;
SELECT engine_name, device_type, cost_name, cost_value
FROM mysql.engine_cost
WHERE cost_name="memory_block_read_cost"
   OR cost_name="io_block_read_cost";
engine_name	device_type	cost_name	cost_value
default	0	io_block_read_cost	2
default	0	memory_block_read_cost	0.5
CREATE TABLE t1 (
i1 INTEGER,
c1 CHAR(200),
INDEX idx (i1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, "Ullensvang"), (2, "Odda"), (3, "Jondal");
# Pass criteria for the query plan:
# 1. Should be executed as an index-only range scan
# 2. Cost estimate: "read_cost" - "eval_cost" should be approximately
#    the cost of reading one page from memory, ie. about 0.5.
EXPLAIN FORMAT=JSON
SELECT i1 FROM t1 WHERE i1 > 1;
EXPLAIN
{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "0.92"
    },
    "table": {
      "table_name": "t1",
      "access_type": "range",
      "possible_keys": [
        "idx"
      ],
      "key": "idx",
      "used_key_parts": [
        "i1"
      ],
      "key_length": "5",
      "rows_examined_per_scan": 2,
      "rows_produced_per_join": 2,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "0.72",
        "eval_cost": "0.20",
        "prefix_cost": "0.92",
        "data_read_per_join": "1K"
      },
      "used_columns": [
        "i1"
      ],
      "attached_condition": "(`test`.`t1`.`i1` > 1)"
    }
  }
}
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where (`test`.`t1`.`i1` > 1)
DROP TABLE t1;
UPDATE mysql.engine_cost
SET cost_value=DEFAULT;
FLUSH OPTIMIZER_COSTS;