1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-20 10:24:14 +03:00
Commit Graph

2248 Commits

Author SHA1 Message Date
5a0874449a MDEV-18755 Assertion `inited==INDEX' failed in handler::ha_index_read_map
When the chosen execution plan accesses a join table employing a range
rowid filter a quick select to scan this range has to be built. This
quick select is built by a call of SQL_SELECT::test_quick_select().
At this call the function should allow to evaluate only single index
range scans. In order to be able to do this a new parameter was added
to this function.
2019-02-28 14:45:01 -08:00
9cb55143ac Minor cleanup in the optimizer trace code.
More test coverage added for the optimizer trace.
2019-02-18 17:11:20 +05:30
98d55b1366 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-14 22:07:33 -08:00
be8709eb7b MDEV-6111 Optimizer Trace
This task involves the implementation for the optimizer trace.

This feature produces a trace for any SELECT/UPDATE/DELETE/,
which contains information about decisions taken by the optimizer during
the optimization phase (choice of table access method, various costs,
transformations, etc). This feature would help to tell why some decisions were
taken by the optimizer and why some were rejected.

Trace is session-local, controlled by the @@optimizer_trace variable.
To enable optimizer trace we need to write:
   set @@optimizer_trace variable= 'enabled=on';

To display the trace one can run:
   SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;

This task also involves:
    MDEV-18489: Limit the memory used by the optimizer trace
    introduces a switch optimizer_trace_max_mem_size which limits
    the memory used by the optimizer trace. This was implemented by
    Sergei Petrunia.
2019-02-13 11:52:36 +05:30
37deed3f37 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-03 18:41:18 -08:00
658128af43 MDEV-16188 Use in-memory PK filters built from range index scans
This patch contains a full implementation of the optimization
that allows to use in-memory rowid / primary filters built for range  
conditions over indexes. In many cases usage of such filters reduce  
the number of disk seeks spent for fetching table rows.

In this implementation the choice of what possible filter to be applied  
(if any) is made purely on cost-based considerations.

This implementation re-achitectured the partial implementation of
the feature pushed by Galina Shalygina in the commit
8d5a11122c.

Besides this patch contains a better implementation of the generic  
handler function handler::multi_range_read_info_const() that
takes into account gaps between ranges when calculating the cost of
range index scans. It also contains some corrections of the
implementation of the handler function records_in_range() for MyISAM.

This patch supports the feature for InnoDB and MyISAM.
2019-02-03 14:56:12 -08:00
78829a5780 Merge 10.3 into 10.4 2019-01-24 22:42:35 +02:00
947b6b849d Merge 10.2 into 10.3 2019-01-24 16:14:12 +02:00
9a7281a703 Merge 10.1 into 10.2 2019-01-23 15:09:06 +02:00
3b6d2efcb1 Merge 10.0 into 10.1 2019-01-23 14:34:23 +02:00
2061e00c20 MDEV-14440: Assertion `inited==RND' failed in handler::ha_rnd_end
In the function QUICK_RANGE_SELECT::init_ror_merged_scan we create a seperate handler if the handler in
head->file cannot be reused. The flag free_file tells us if we have a seperate handler or not.
There are cases where you might create a handler and then there might be a failure(running ALTER)
and then we have to revert the handler back to the original one. The code does that
but it does not reset the flag 'free_file' in this case.
Also backported f2c418079d.
2019-01-18 23:36:47 +05:30
6bb11efa4a Merge branch '10.2' into 10.3 2019-01-03 13:09:41 +01:00
88cc78c9c4 Removed compiler warnings 2019-01-01 15:12:39 +02:00
67240858b2 Merge branch '10.1' into 10.2 2018-12-30 18:30:29 +01:00
aeefd26ecb Merge branch '10.0' into 10.1 2018-12-29 23:44:45 +01:00
1a7158b88a remove unsed variable 2018-12-13 19:51:40 +01:00
c64265f3f9 Merge 10.3 into 10.4 2018-12-12 14:09:48 +02:00
839cf16bb2 Merge 10.2 into 10.3 2018-12-12 13:46:06 +02:00
db1210f939 Merge 10.1 into 10.2 2018-12-12 12:13:43 +02:00
f77f8f6d1a Merge 10.0 into 10.1 2018-12-12 10:48:53 +02:00
4886d14827 MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
The problem here is EITS statistics does not calculate statistics for the partitions of the table.
So a temporary solution would be to not read EITS statistics for partitioned tables.

Also disabling reading of EITS for columns that participate in the partition list of a table.
2018-12-07 19:59:45 +05:30
ce8716a1ed Merge 10.3 into 10.4 2018-12-07 16:29:37 +02:00
21069c528e Merge 10.2 into 10.3 2018-12-07 15:39:34 +02:00
5e5deabdbc Merge 10.1 into 10.2 2018-12-07 13:41:10 +02:00
6491c591b2 Merge branch '10.0' into 10.1 2018-12-06 15:08:42 +01:00
14f6b0cdfd MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
In this case we were trying to access memory for key_parts which we did not
assign for a fields because it did not any EITS statistics.
The check if EITS statistics for a column is avaialable or not was missing.
2018-11-20 20:16:38 +05:30
5f46670bd0 Merge branch '10.4' into 10.4-mdev16188 2018-11-10 14:52:57 -08:00
074c684099 Merge 10.3 into 10.4 2018-11-06 16:24:16 +02:00
df563e0c03 Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end,
trim trailing white space, and add an "End of 10.3 tests" marker.
Add --sorted_result to tests where the ordering is not deterministic.

main.win_percentile: Add --sorted_result to tests where the
ordering is no longer deterministic.
2018-11-06 09:40:39 +02:00
32062cc61c Merge 10.1 into 10.2 2018-11-06 08:41:48 +02:00
d63e198061 Merge 10.0 into 10.1 2018-11-05 12:15:17 +02:00
38b3e52c3c MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
For index merge union[or sort union], the estimates are not taken into account while calculating the selectivity of
a condition. So instead of showing the estimates of the index merge union[or sort union], it shows estimates equal to
all the records of the table.
The fix for the issue is to include the selectivity of index merge
union[or sort union] while calculating the selectivity of a condition.
2018-11-01 13:20:26 +05:30
444c380ceb Merge 10.3 into 10.4 2018-10-05 08:09:49 +03:00
8d5a11122c MDEV-16188: Use in-memory PK filters built from range index scans
First phase: make optimizer choose to use filter and show it in EXPLAIN.
2018-09-28 23:50:22 +03:00
57e0da50bb Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
28f08d3753 Merge branch '10.1' into 10.2 2018-09-14 08:47:22 +02:00
1bf3e8ab43 Merge 10.3 into 10.4 2018-09-11 21:31:03 +03:00
31081593aa Merge branch '11.0' into 10.1 2018-09-06 22:45:19 +02:00
b3c320bb0b MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with
optimizer_use_condition_selectivity>=3

Selectivity analysis should be disabled for Geometrical columns
for the case like geometric_field= string_constant.
2018-08-29 12:48:23 +05:30
a9c09c95bd MDEV-15306: Wrong/Unexpected result with the value optimizer_use_condition_selectivity set to 4
Currently for selectivity calculation we perform range analysis for a column even when we don't have any statistics(EITS).
This makes less sense but is used to catch contradiction for WHERE condition.

So the solution is to not perform range analysis for selectivity calculation for columns that do not have statistics.
2018-08-29 02:17:37 +05:30
7830fb7f45 Merge 10.2 into 10.3 2018-08-28 12:22:56 +03:00
c826b6b8da Added a new parameter for the function eq_ranges_exceeds_limit()
introduced in the patch fo MDEV-16934.
2018-08-24 20:53:00 -07:00
7d8d37c31d MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4
and use_stat_tables= PREFERABLY

Currently the code that calculates selectivity for a table does not take into account the case when
we can have GROUP BY optimization (looses index scan).
2018-08-23 16:01:58 +05:30
4eac5df3fc MDEV-16934 Query with very large IN clause lists runs slowly
This patch introduces support for the system variable eq_range_index_dive_limit
that existed in MySQL starting from 5.6. The variable sets a limit for
index dives into equality ranges. Index dives are performed by optimizer
to estimate the number of rows in range scans. Index dives usually provide
good estimate but they are pretty expensive. To estimate the number of rows
in equality ranges statistical data on indexes can be employed. Its usage gives
not so good estimates but it's cheap. So if the number of equality dives
required by an index scan exceeds the set limit no dives for equality
ranges are performed by the optimizer for this index.

As the new system variable is introduced in a stable version the default
value for it is set to a special value meaning there is no limit for the number
of index dives performed by the optimizer.

The patch partially uses the MySQL code for WL 5957
'Statistics-based Range optimization for many ranges'.
2018-08-17 14:28:39 -07:00
734db318ac Merge 10.3 into 10.4 2018-08-16 10:08:30 +03:00
0aa9b03393 Merge branch '10.2' into 10.3 2018-08-12 12:02:23 +02:00
affdd79c69 Merge branch '10.1' into 10.2 2018-08-03 23:26:26 +02:00
701f0b8e36 Fix gcc 7.3 compiler warnings. 2018-08-03 14:37:55 +02:00
fee4632387 MDEV-15758 Split Item_bool_func::get_mm_leaf() into virtual methods in Field and Type_handler 2018-07-20 11:07:19 +04:00
6bfeace10b MDEV-15759 Expect "Impossible WHERE" for indexed_int_column=out_of_range_int_constant 2018-07-19 17:09:24 +04:00