title: Virtual Column based query performance without index in MySQL
body: <p>I set a virtual column based on a JSON type column in Mysql 8.0.19 version and set secondary indexes for it.</p>
  <p>But, in some cases, virtual column-based indexes are not used due to complex query conditions.</p>
  <p>In this case, would MySQL re-parsing each JSON columns for SELECT query?</p>
  <p>If that's true, I need to set an index for all conditions that use virtual columns.</p>
  <p><strong>example</strong>:</p>
  <ol>
  <li>create &amp; insert</li>
  </ol>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE `test_table` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `json` json NOT NULL,
    `optional` int(11) DEFAULT NULL,
    `_virtual_column` int(11) GENERATED ALWAYS AS (json_extract(`json`,'$.val')) VIRTUAL,
    PRIMARY KEY (`id`),
    KEY `_index` (`_virtual_column`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  INSERT INTO `test_table` (`json`, `optional`) VALUES ('{\&quot;val\&quot;:1, \&quot;val2\&quot;:2}', '1');
  INSERT INTO `test_table` (`json`) VALUES ('{\&quot;val\&quot;:1, \&quot;val2\&quot;:2}');
  INSERT INTO `test_table` (`json`, `optional`) VALUES ('{\&quot;val\&quot;:3, \&quot;val2\&quot;:3}', '3');
  INSERT INTO `test_table` (`json`, `optional`) VALUES ('{\&quot;val\&quot;:3, \&quot;val2\&quot;:4}', '4');
  
  </code></pre>
  <ol start="2">
  <li>query without index</li>
  </ol>
  <pre class="lang-sql prettyprint-override"><code>SELECT * FROM test_table WHERE optional != null AND id &lt; 3 AND optional = 1 AND _virtual_column &gt;= 1;
  </code></pre>
  <p>It's a strange query I made for the situation where the index is not used.</p>
  <p>Anyway, I wonder if virtual column parsing is processed if virtual column-based indexes are not used.</p>
  <p>Thanks.</p>