mariadb/mysql-test/suite/gcol/r
Yuchen Pei 04254ffed1
MDEV-36132 Substitute vcol expressions with indexed vcol fields in ORDER BY
Also expand vcol field index coverings to include indexes covering all
the fields in the expression. The reasoning goes as follows: let f(c1,
c2, ..., cn) be a function on applied to columns c1, c2, ..., cn, if
f(...) is covered by an index, so should vc whose expression is
f(...).

For example, if t.vf = t.c1 + t.c2, and t has three indexes (vf), (c1,
c2), (c1).

Before this change, vf's index covering is a singleton {(vf)}. Let's call
that the "conventional" index covering.

After this change vf's index covering is now {(vf), (c1, c2)}, since
(c1, c2) covers both c1 and c2. Let's call (c1, c2) in this case the
"extra" covering.

With the coverings updated, when an index in the "extra" covering is
chosen for keyread, the vcol also needs to be calculated. In this case
we mark vcol in the table read_set, and ensure it is computed.

With these changes, we see various improvements, including from using
full table scan + filesort to full index scan + filesort when ORDER BY
an indexed vcol (here vc = c + 1 is a vcol and both c and vc are
indexes):

 explain select c + 1 from t order by vc;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t	ALL	NULL	NULL	NULL	NULL	10000	Using filesort
+1	SIMPLE	t	index	NULL	c	5	NULL	10000	Using index; Using filesort
2025-05-14 18:08:54 +10:00
..
federated_gcol.result
gcol_archive.result
gcol_blackhole.result
gcol_blocked_sql_funcs_innodb.result allow random_bytes() in virtual columns 2023-08-15 10:16:10 +02:00
gcol_blocked_sql_funcs_myisam.result allow random_bytes() in virtual columns 2023-08-15 10:16:10 +02:00
gcol_bug20746926.result
gcol_bugfixes.result MDEV-33281 Optimizer hints Cleanup: fix formatting, rename objects 2025-05-05 12:02:47 +07:00
gcol_column_def_options_innodb.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
gcol_column_def_options_myisam.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
gcol_csv.result MDEV-18650: Options deprecated in previous versions - storage_engine 2020-02-13 13:42:01 +02:00
gcol_falcon.result MDEV-18650: Options deprecated in previous versions - storage_engine 2020-02-13 13:42:01 +02:00
gcol_handler_innodb.result
gcol_handler_myisam.result
gcol_ins_upd_innodb.result Added test cases for preceding test 2023-02-03 00:00:35 +03:00
gcol_ins_upd_myisam.result Merge branch '10.4' into 10.5 2021-07-31 23:19:51 +02:00
gcol_keys_innodb.result MDEV-35616: Add basic optimizer support for virtual column 2025-01-25 10:50:52 +02:00
gcol_keys_myisam.result MDEV-35616: Add basic optimizer support for virtual column 2025-01-25 10:50:52 +02:00
gcol_memory.result
gcol_merge.result
gcol_ndb.result
gcol_non_stored_columns_innodb.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
gcol_non_stored_columns_myisam.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
gcol_partition_innodb.result MDEV-32050 fixup: Stabilize tests 2023-11-21 12:42:00 +02:00
gcol_partition_myisam.result MDEV-26220 Server crashes with indexed by prefix virtual column 2021-08-02 10:31:22 +02:00
gcol_purge.result MDEV-32050 fixup: Stabilize tests 2023-11-21 12:42:00 +02:00
gcol_rejected_innodb.result
gcol_rollback.result MDEV-30597 Assertion `flag == 1' failed in row_build_index_entry_low 2023-02-14 14:28:27 +05:30
gcol_select_innodb.result MDEV-36132 Substitute vcol expressions with indexed vcol fields in ORDER BY 2025-05-14 18:08:54 +10:00
gcol_select_myisam.result MDEV-36132 Substitute vcol expressions with indexed vcol fields in ORDER BY 2025-05-14 18:08:54 +10:00
gcol_supported_sql_funcs_innodb.result Merge branch '11.4' into 11.7 2025-02-06 16:46:36 +01:00
gcol_supported_sql_funcs_myisam.result Merge branch '11.4' into 11.7 2025-02-06 16:46:36 +01:00
gcol_trigger_sp_innodb.result
gcol_trigger_sp_myisam.result
gcol_update.result MDEV-32050 fixup: Stabilize tests 2023-11-21 12:42:00 +02:00
gcol_view_innodb.result MDEV-4750 follow-up: Reduce disabling innodb_stats_persistent 2021-08-31 13:55:02 +03:00
gcol_view_myisam.result MDEV-4750 follow-up: Reduce disabling innodb_stats_persistent 2021-08-31 13:55:02 +03:00
innodb_partition.result
innodb_prefix_index_check.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
innodb_virtual_basic.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
innodb_virtual_blob.result
innodb_virtual_debug.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
innodb_virtual_debug_purge.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
innodb_virtual_fk.result Merge 10.9 into 10.10 2022-09-21 10:59:56 +03:00
innodb_virtual_fk_restart.result Write information about restart in .result 2019-04-01 19:47:24 +03:00
innodb_virtual_index.result MDEV-36132 Substitute vcol expressions with indexed vcol fields in ORDER BY 2025-05-14 18:08:54 +10:00
innodb_virtual_purge.result MDEV-32050 fixup: Stabilize tests 2023-11-21 12:42:00 +02:00
innodb_virtual_rebuild.result support 'alter online table t1 page_checksum=0' 2023-08-15 10:16:11 +02:00
innodb_virtual_stats.result MDEV-35000: dict_table_close() breaks STATS_AUTO_RECALC 2025-02-28 09:00:16 +02:00
innodb_wl8114.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
main_alter_table.result MDEV-16678: Fix a problem with duplicate #sql2 table names 2019-12-10 16:18:30 +02:00
main_mysqldump.result
rpl_gcol.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
virtual_index_drop.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00