[MDEV-16487] derived_with_keys not working Created: 2018-06-14 Updated: 2018-10-01 Resolved: 2018-10-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Zakharov Sergey | Assignee: | Alice Sherepa |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
After update MariaDB from 10.1.15 to 10.3.7 optimizer_switch derived_with_keys does not work.
On 10.1.15 save explain:
|
| Comments |
| Comment by Alice Sherepa [ 2018-06-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Could you please provide SHOW CREATE VIEW and structures of involved tables. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Zakharov Sergey [ 2018-06-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
main.cnf the same. CREATE VIEW `ars_report_full_order_status_history` AS select max(`oh`.`p_order`) AS `order_id`,max(`oh`.`createdTS`) AS `creation_date`,max(`oh`.`modifiedTS`) AS `modification_date`,group_concat(`oh`.`p_description`,'' separator ',') AS `description`,max(`oh`.`p_prevstatus`) AS `previous_status_id`,max(`oh`.`p_orderstatus`) AS `current_status_id`,max(`oh`.`p_employee`) AS `employee_id`,max(`u`.`user_id`) AS `user_id`,max(`u`.`user_name`) AS `user_name`,max(`u`.`user_roles`) AS `user_roles` from ((`ars_report_full_order_status_orders` `o` join `orderhistoryentries` `oh` on(`o`.`PK` = `oh`.`p_order`)) join `ars_report_full_order_status_user_groups` `u` on(`oh`.`p_employee` = `u`.`user_id`)) where (`oh`.`p_orderstatus` is not null or `oh`.`p_prevstatus` is not null) and `oh`.`p_order` is not null group by `oh`.`p_order`,`oh`.`p_prevstatus`,`oh`.`p_orderstatus` order by NULL Second view: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ars_report_full_order_status_orders` AS select `o`.`hjmpTS` AS `hjmpTS`,`o`.`createdTS` AS `createdTS`,`o`.`modifiedTS` AS `modifiedTS`,`o`.`TypePkString` AS `TypePkString`,`o`.`OwnerPkString` AS `OwnerPkString`,`o`.`PK` AS `PK`,`o`.`calculatedflag` AS `calculatedflag`,`o`.`code` AS `code`,`o`.`currencypk` AS `currencypk`,`o`.`deliveryaddresspk` AS `deliveryaddresspk`,`o`.`deliverycost` AS `deliverycost`,`o`.`deliverymodepk` AS `deliverymodepk`,`o`.`deliverystatuspk` AS `deliverystatuspk`,`o`.`globaldiscountvalues` AS `globaldiscountvalues`,`o`.`netflag` AS `netflag`,`o`.`paymentaddresspk` AS `paymentaddresspk`,`o`.`paymentcost` AS `paymentcost`,`o`.`paymentinfopk` AS `paymentinfopk`,`o`.`paymentmodepk` AS `paymentmodepk`,`o`.`paymentstatuspk` AS `paymentstatuspk`,`o`.`statuspk` AS `statuspk`,`o`.`p_exportstatus` AS `p_exportstatus`,`o`.`statusinfo` AS `statusinfo`,`o`.`totalprice` AS `totalprice`,`o`.`totaldiscounts` AS `totaldiscounts`,`o`.`totaltax` AS `totaltax`,`o`.`totaltaxvalues` AS `totaltaxvalues`,`o`.`userpk` AS `userpk`,`o`.`subtotal` AS `subtotal`,`o`.`discountondelivery` AS `discountondelivery`,`o`.`discountonpayment` AS `discountonpayment`,`o`.`p_previousdeliverymode` AS `p_previousdeliverymode`,`o`.`p_site` AS `p_site`,`o`.`p_store` AS `p_store`,`o`.`p_guid` AS `p_guid`,`o`.`p_yoyosum` AS `p_yoyosum`,`o`.`p_transportcompany` AS `p_transportcompany`,`o`.`p_freevouchers` AS `p_freevouchers`,`o`.`p_pointofservice` AS `p_pointofservice`,`o`.`p_deliveryzonelist` AS `p_deliveryzonelist`,`o`.`p_tariffzonelist` AS `p_tariffzonelist`,`o`.`p_ordersubstatus` AS `p_ordersubstatus`,`o`.`p_deletelines` AS `p_deletelines`,`o`.`p_weight` AS `p_weight`,`o`.`p_volume` AS `p_volume`,`o`.`p_weightbulky` AS `p_weightbulky`,`o`.`p_volumebulky` AS `p_volumebulky`,`o`.`p_paywithgift` AS `p_paywithgift`,`o`.`p_paywithyoyo` AS `p_paywithyoyo`,`o`.`p_deletedfreegoodsmap` AS `p_deletedfreegoodsmap`,`o`.`p_versionid` AS `p_versionid`,`o`.`p_originalversion` AS `p_originalversion`,`o`.`p_fraudulent` AS `p_fraudulent`,`o`.`p_potentiallyfraudulent` AS `p_potentiallyfraudulent`,`o`.`p_salesapplication` AS `p_salesapplication`,`o`.`p_language` AS `p_language`,`o`.`p_deliverydate` AS `p_deliverydate`,`o`.`p_deliverytime` AS `p_deliverytime`,`o`.`p_shippingdate` AS `p_shippingdate`,`o`.`p_informingmethod` AS `p_informingmethod`,`o`.`p_requesteddeliverydate` AS `p_requesteddeliverydate`,`o`.`p_sendsmswhenstatuschanged` AS `p_sendsmswhenstatuschanged`,`o`.`p_sapapprovedate` AS `p_sapapprovedate`,`o`.`p_sapcalculatedate` AS `p_sapcalculatedate`,`o`.`p_sapreservedate` AS `p_sapreservedate`,`o`.`p_ordertype` AS `p_ordertype`,`o`.`p_promotionsdate` AS `p_promotionsdate`,`o`.`p_operator` AS `p_operator`,`o`.`p_buyerpaymentresulterror` AS `p_buyerpaymentresulterror`,`o`.`p_parentorder` AS `p_parentorder`,`o`.`p_cslockdate` AS `p_cslockdate`,`o`.`p_cslockoperator` AS `p_cslockoperator`,`o`.`p_ismigrated` AS `p_ismigrated`,`o`.`p_partlypaidsum` AS `p_partlypaidsum`,`o`.`p_deliveryinterval` AS `p_deliveryinterval`,`o`.`p_refunddate` AS `p_refunddate`,`o`.`p_yoyoawardedpoints` AS `p_yoyoawardedpoints`,`o`.`p_yoyodebitedpoints` AS `p_yoyodebitedpoints`,`o`.`p_needrefundyoyo` AS `p_needrefundyoyo`,`o`.`p_giftusedforyoyoaddpoints` AS `p_giftusedforyoyoaddpoints`,`o`.`p_processedtime` AS `p_processedtime`,`o`.`aCLTS` AS `aCLTS`,`o`.`propTS` AS `propTS`,`o`.`p_fulfilmentstatus` AS `p_fulfilmentstatus`,`o`.`p_notes` AS `p_notes`,`o`.`p_computerid` AS `p_computerid`,`o`.`p_ordercreator` AS `p_ordercreator`,`o`.`p_fiascode` AS `p_fiascode`,`o`.`originaldeliverycost` AS `originaldeliverycost`,`o`.`p_ordernotificationstatus` AS `p_ordernotificationstatus`,`o`.`p_chequeassigned` AS `p_chequeassigned`,`o`.`refundeddeliverycost` AS `refundeddeliverycost`,`o`.`p_remindsmscount` AS `p_remindsmscount`,`o`.`p_checkoutsuccess` AS `p_checkoutsuccess`,`o`.`p_modified` AS `p_modified`,`o`.`p_dateofstatusupdate` AS `p_dateofstatusupdate`,`o`.`p_instorecompleted` AS `p_instorecompleted` from `orders` `o` Third view: CREATE VIEW `ars_report_full_order_status_user_groups` AS select `u`.`PK` AS `user_id`,max(`u`.`name`) AS `user_name`,group_concat(`ugl`.`p_locname` separator '; ') AS `user_roles` from ((`users` `u` join `pgrels` `pgr` on(`u`.`PK` = `pgr`.`SourcePK`)) join `usergroupslp` `ugl` on(`ugl`.`ITEMPK` = `pgr`.`TargetPK` and `ugl`.`LANGPK` = (select `ars_report_ru_lang_pk`.`pk` from `ars_report_ru_lang_pk`))) group by `u`.`PK` order by NULL Fourth view: Tables order: CREATE TABLE `languages` ( CREATE TABLE `orders` ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-06-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Please add | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Zakharov Sergey [ 2018-06-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
CREATE TABLE `pgrels` ( CREATE TABLE `usergroupslp` ( CREATE TABLE `orderhistoryentries` ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-06-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry, missed one table - SHOW CREATE TABLE ars_report_ru_lang_pk; | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Zakharov Sergey [ 2018-06-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ars_report_ru_lang_pk` AS select `l`.`PK` AS `pk` from `languages` `l` where `l`.`isocode` = 'ru' 10.1.15
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10.3.7 ANALYZE{ , , , , 1 row in set (2 hours 36 min 56.587 sec) | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-07-03 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
I can not reproduce it for now. Tried with 16487.sql
| |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by MArcel Zielinski [ 2018-09-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
@Zakharov Sergey I found this ticket, while dealing with same problem. First it looks like a MariaDB problem, as after migrating the database to an older server the problem vanished. Together with your ticket report, we were quit sure that this is also our problem. Finally the cause was a different one: One table was somehow broken, only an ex-/import solved the problem, we tried all known repair options - finally we used a select Into to build the table new and the problem vanished. The only difference we identified was the idnex length of the affected key, but found no means to repair/restore it in the affected table. |