Commit graph

19 commits

Author SHA1 Message Date
Sergei Petrunia
f1a1683309 MDEV-6384: It seems like OPTIMIZER take into account the order of indexes in the table
When ORDER BY ... LIMIT check whether it should switch from index IDX1
to index IDX2, it should not ignore the fact that IDX2 may have a
potential range or ref(const) access.
Istead, it should calculate their costs: there is now a saved range
optimizer cost and code to re-calculate what best_access_path()
calculated for ref(const).

/* in current cost model these two can be very different
numbers unfortunately */
2014-08-27 20:08:32 +04:00
Sergei Golubchik
4c788b06d4 10.0-base merge 2014-03-05 23:20:10 +01:00
Sergey Petrunya
d7081b2524 Update test results after fix for MDEV-5732 2014-02-27 13:40:40 +04:00
Sergei Golubchik
72c20282db 10.0-base merge 2014-02-03 15:22:39 +01:00
Michael Widenius
c050b5fdf9 Fixed MDEV-5424: SELECT using ORDER BY DESC and LIMIT produces unexpected results (InnoDB/XtraDB)
This only happend when using an ORDER BY on a primary key part, where all other key parts where constant.
Remove of duplicated expressions in ORDER BY (as the old code did this in some strange cases)


mysql-test/r/group_by.result:
  Fixed results to take into account that duplicate order by parts are now deleted
mysql-test/r/group_by_innodb.result:
  Ensure extended keys are on
mysql-test/r/innodb_ext_key.result:
  More tests
mysql-test/r/order_by.result:
  More tests
mysql-test/t/group_by.test:
  Fixed results to take into account that duplicate order by parts are now deleted
mysql-test/t/group_by_innodb.test:
  Ensure extended keys are on
mysql-test/t/innodb_ext_key.test:
  More tests
mysql-test/t/order_by.test:
  More tests
sql/sql_select.cc:
  Fixed bug where we looked at extended key parts when we shouldn't
  Remove of duplicated expressions in ORDER BY
sql/table.cc:
  Indentation fixes
2014-01-02 15:51:02 +02:00
Igor Babaev
b07d0e2a4c MDEV-4786 - merge 10.0-monty - 10.0
Fixed failure of one of the test case from innodb_ext_key.test.
The fact is that the innodb code may return statistical data
on record per key values that is far off the real numbers. 
This is exactly what happened in mariadb-5.5 with this test case.

Added an ANALYZE command in this test case to avoid this problem.
The same change will be done in mariadb-5.5
2013-07-26 18:48:06 -07:00
Igor Babaev
f225f5485c Fixed bug mdev-4340.
The function make_join_statistics checks whether eq_ref access uses only
constant expressions, and, if this is the case the function performs
constant row substitution. The code of this check must take into account
hidden components of extended secondary keys.
2013-04-27 23:28:48 -07:00
Igor Babaev
bd305d6b21 Fixed bug mdev-4220.
This bug is a regression bug. The regression was introduced by
the patch for mdev-3851, that tried to weaken the condition when
a ref access with an extended key can be converted to an eq_ref
access. The patch incorrectly formed this condition. As a result,
while improving performance for some queries, the patch caused 
worse performance for another queries.
2013-03-02 12:36:32 -08:00
Igor Babaev
5e345281e3 Fixed bug mdev-3888.
When inserting a record with update on duplicate keys the server calls
the ha_index_read_idx_map handler function to look for the record
that violates unique key constraints. The third parameter of this call
should mark only the base components of the index where the server is
searched for the record. Possible hidden components of the primary key
are to be unmarked.
2012-12-04 16:06:07 -08:00
Igor Babaev
e08f4f1630 Fixed bug mdev-3851.
Any ref access to a table by a key fully extended by the components
of the primary key should be actually an eq_ref access.
2012-11-11 11:47:44 -08:00
Sergei Golubchik
867296c3ed 5.3 merge 2012-03-28 20:25:31 +02:00
Igor Babaev
8bc5045ea3 Merge MWL #247 from mariadb 5.3 -> mariadb 5.5. 2012-03-02 15:03:20 -08:00
Igor Babaev
9db23c8280 Merge. 2012-02-27 21:23:12 -08:00
Igor Babaev
56e1a6936b Fixed LP bug #923236.
When working on MWL#247 I forgot to adjust the function create_hj_key_for_table()
that created a key definition for hash join keys. The modified function must
set the values of the fields ext_key_parts, ext_key_flags, ext_key_part_map
added to the key definition structure in MWL#247.
2012-01-29 14:35:30 -08:00
Igor Babaev
51847a0fba Fixed LP bug #921167.
The fields ext_key_flags and ext_key_part_map must be initialized for any
key, even for a MyISAM key that never is considered by the optimizer as one
extended by hidden components.
2012-01-24 23:34:02 -08:00
Igor Babaev
507e1927e1 Merge. 2012-01-24 21:12:02 -08:00
Igor Babaev
e63506af2b Added a test case for LP bug #915291.
The bug was fixed by the patch for bug 914560.
2012-01-18 19:38:03 -08:00
Igor Babaev
7902a73d4c Fixed LP bug #914560.
The patch for MWL #247 forgot to initialize the TABLE::ext_key_parts and
TABLE::ext_key_flags of the temporary tables by a query. This could cause
crashes for queries the execution of which needed creation of temporary
tables.
2012-01-17 03:26:49 -08:00
Igor Babaev
b6b5f9fabe Implementation of the MWL#247: Make the optimizer use extended keys.
The main patch.
.
2011-12-31 02:25:57 -08:00