Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Cannot Reproduce
-
1.4.2
-
None
Description
Accidentally stumbled onto this while testing some machine-generated SQL with ColumnStore from X4.
MariaDB [bookstore]> SELECT trans_date FROM `bookstore`.`transactions` LIMIT 0;
---------------------
trans_date ---------------------
2018-05-07 16:46:50 ---------------------
1 row in set (0.032 sec)
As a comparison, with InnoDB:
MariaDB [bookstore]> SELECT trans_date FROM `bookstore`.`Transactions` LIMIT 0;
Empty set (0.000 sec)
"SELECT * ... LIMIT 0" is used by the client software as a generic way to determine columns and datatypes. May not be super smart and a bit to the side of how we do things manually, but is generic and works with many databases.
ColumnStore should respect the LIMIT 0 properly, because the same stanza can also be seen in "CREATE TABLE AS SELECT... LIMIT 0" (again, we would have probably written just "CREATE TABLE LIKE..." manually) - in whcih case we obviously don't want anything going into the newly created table. I have even seen MaxScale used to automatically append "LIMIT 0" to "CREATE TABLE AS SELECT" to prevent performance-sensitive setups (e.g., a Galera cluster) from being hosed for hours by such a query.