[MCOL-3690] SELECT only validates extent for the first column from the select list Created: 2019-12-25  Updated: 2019-12-26  Resolved: 2019-12-26

Status: Closed
Project: MariaDB ColumnStore
Component/s: N/A
Affects Version/s: 1.4.2
Fix Version/s: Icebox

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

Note: Possibly it's a documentation shortage (obscurity) only.

According to the KB, COLUMNSTORE_EXTENTS.STATE is Invalid if the table has not been accessed. If "table" here is the MariaDB table, it is not quite accurate. The state remains Invalid even if the table is accessed for all columns from the select list except for the first one.

MariaDB f93bfb9288d020b190f5c73a31223fff6439687d

MariaDB [db]> create table t1 (a int, b int, c int) engine=Columnstore;
Query OK, 0 rows affected (0.565 sec)
 
MariaDB [db]> insert into t1 values (1,1,1);
Query OK, 1 row affected (0.223 sec)
 
MariaDB [db]> select * from information_schema.columnstore_extents;
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
| OBJECT_ID | OBJECT_TYPE | LOGICAL_BLOCK_START | LOGICAL_BLOCK_END | MIN_VALUE | MAX_VALUE | WIDTH | DBROOT | PARTITION_ID | SEGMENT_ID | BLOCK_OFFSET | MAX_BLOCKS | HIGH_WATER_MARK | STATE   | STATUS    | DATA_SIZE |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
|      3175 | Column      |              234496 |            238591 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
|      3176 | Column      |              238592 |            242687 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
|      3177 | Column      |              242688 |            246783 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
3 rows in set (0.040 sec)
 
MariaDB [db]> select a, b, c from t1;
+------+------+------+
| a    | b    | c    |
+------+------+------+
|    1 |    1 |    1 |
+------+------+------+
1 row in set (0.079 sec)
 
MariaDB [db]> select * from information_schema.columnstore_extents;
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
| OBJECT_ID | OBJECT_TYPE | LOGICAL_BLOCK_START | LOGICAL_BLOCK_END | MIN_VALUE | MAX_VALUE | WIDTH | DBROOT | PARTITION_ID | SEGMENT_ID | BLOCK_OFFSET | MAX_BLOCKS | HIGH_WATER_MARK | STATE   | STATUS    | DATA_SIZE |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
|      3175 | Column      |              234496 |            238591 |         1 |         1 |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Valid   | Available |         0 |
|      3176 | Column      |              238592 |            242687 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
|      3177 | Column      |              242688 |            246783 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
3 rows in set (0.037 sec)
 
MariaDB [db]> select c, b, a from t1;
+------+------+------+
| c    | b    | a    |
+------+------+------+
|    1 |    1 |    1 |
+------+------+------+
1 row in set (0.024 sec)
 
MariaDB [db]> select * from information_schema.columnstore_extents;
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
| OBJECT_ID | OBJECT_TYPE | LOGICAL_BLOCK_START | LOGICAL_BLOCK_END | MIN_VALUE | MAX_VALUE | WIDTH | DBROOT | PARTITION_ID | SEGMENT_ID | BLOCK_OFFSET | MAX_BLOCKS | HIGH_WATER_MARK | STATE   | STATUS    | DATA_SIZE |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
|      3175 | Column      |              234496 |            238591 |         1 |         1 |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Valid   | Available |         0 |
|      3176 | Column      |              238592 |            242687 |      NULL |      NULL |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Invalid | Available |         0 |
|      3177 | Column      |              242688 |            246783 |         1 |         1 |     4 |      1 |            0 |          0 |            0 |       4096 |               0 | Valid   | Available |         0 |
+-----------+-------------+---------------------+-------------------+-----------+-----------+-------+--------+--------------+------------+--------------+------------+-----------------+---------+-----------+-----------+
3 rows in set (0.039 sec)



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2019-12-26 ]

This shouldn't validate all columns, only the first used in a projection. Validating all unnecessary columns would be a performance penalty and that could be a bug.

Comment by Elena Stepanova [ 2019-12-26 ]

This needs to be documented on the above-mentioned page.

Comment by Andrew Hutchings (Inactive) [ 2019-12-26 ]

The full explanation of the algorithm is too complex to add there, what is there is a simplification. Maybe a document explaining the extent map architecture would be better?

Comment by Elena Stepanova [ 2019-12-26 ]

Right, and then link to it from that "Notes" block with something like "see more details about validation at ...".

Generated at Thu Feb 08 02:44:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.