Skip to content
Permalink
Browse files
Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
  simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
  partition_pruning etc are becasue partitions can now more exactly
  calculate the number of rows in a range.

Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
  • Loading branch information
montywi committed Dec 3, 2017
1 parent d5268a6 commit 8eeb689
Show file tree
Hide file tree
Showing 26 changed files with 2,486 additions and 224 deletions.
@@ -204,6 +204,11 @@ enum ha_extra_function {
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE,
/* Inform handler that we will do an alter table */
HA_EXTRA_PREPARE_FOR_ALTER_TABLE,
/*
Used in ha_partition::handle_ordered_index_scan() to inform engine
that we are starting an ordered index scan. Needed by Spider
*/
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN
};

/* Compatible option, to be deleted in 6.0 */
@@ -45,6 +45,8 @@ extern "C" {
/* compatibility functions */
#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
#define bitmap_free(A) my_bitmap_free(A)
/* Reset memory. Faster then doing a full bzero */
#define my_bitmap_clear(A) ((A)->bitmap= 0)

extern void create_last_word_mask(MY_BITMAP *map);
extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
@@ -29,7 +29,7 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index
1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index
DROP TABLE t1;
#
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
@@ -663,7 +663,7 @@ EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
GROUP BY 1, 2, 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,col1,col2 col1,col2 8,8 NULL # Using intersect(col1,col2); Using where; Using index; Using filesort
1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort
SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2
AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
GROUP BY 1, 2, 3;

Large diffs are not rendered by default.

@@ -961,7 +961,7 @@ INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
@@ -972,7 +972,7 @@ a MAX(b)
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
Handler_read_key 2
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
@@ -22,7 +22,7 @@ INSERT INTO t2 SELECT * FROM t1;
# plans should be identical
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
@@ -33,7 +33,7 @@ a MAX(b)
# Should be no more than 4 reads.
SHOW status LIKE 'handler_read_key';
Variable_name Value
Handler_read_key 4
Handler_read_key 2
FLUSH status;
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
a MAX(b)
@@ -2812,6 +2812,7 @@ INSERT INTO t1 VALUES (123,123,'2001-04-14','address123','city123',40,51),
(257,257,'2010-03-06','address257','city257',40,47);
--enable_query_log

--sorted_result
select * from t1 where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';
select * from t1 IGNORE INDEX(dob, weeks_worked_last_year, hours_worked_per_week) where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';

@@ -166,6 +166,9 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos)
return MY_BIT_NONE; /* Impossible */
}

/*
Initialize a bitmap object. All bits will be set to zero
*/

my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
my_bool thread_safe)

0 comments on commit 8eeb689

Please sign in to comment.