[MDEV-29538] Querry latency on some version of mariadb Created: 2022-09-14  Updated: 2022-10-17  Resolved: 2022-10-17

Status: Closed
Project: MariaDB Server
Component/s: Query Cache
Affects Version/s: 10.3.29
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: wareteamflo Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: performance
Environment:

Debian 11.4 using Docker


Issue Links:
Relates
relates to MDEV-29442 Optimizer bug Confirmed

 Description   

Hi,

I'm facing on issue with this request :

SELECT DISTINCT(e.id) as id, e.code_barre, e.flag_fusion, f.libelle as famille, sf.libelle as sousFamille, m.nom, pl.libelle as plateforme, et.libelle as etat, e.quantite_reserve, e.stock_magasin, e.stock_amazon, e.stock_cdiscount_fbc, m.prix_vente_ht,m.prix_vente_ttc, m.cree_automatiquement, emp.code as emplacement, m.id as materielId, m.prix_achat_moyen_ht as prixAchatMoyenHt, e.asin FROM materiel_code_barre AS e LEFT JOIN materiel as m ON e.materiel_id = m.id LEFT JOIN stock_emplacement as emp ON e.ean_emplacement = emp.id LEFT JOIN materiel_etat as et ON m.etat_id = et.id LEFT JOIN materiel_plateforme as pl ON m.plateforme_id = pl.id LEFT JOIN categorie as f ON m.famille_id = f.id LEFT JOIN categorie as sf ON m.sous_famille_id = f.id WHERE e.code_barre is not null AND e.code_barre <> ''AND ( e.id LIKE "%5056208812636%" OR f.libelle LIKE "%5056208812636%" OR sf.libelle LIKE "%5056208812636%" OR m.nom LIKE "%5056208812636%" OR pl.libelle LIKE "%5056208812636%" OR et.libelle LIKE "%5056208812636%" OR e.stock_magasin LIKE "%5056208812636%" OR e.code_barre LIKE "%5056208812636%" OR e.asin LIKE "%5056208812636%" OR ( SELECT COUNT(e.id) FROM materiel_code_barre e2 JOIN stock_emplacement as em2 on e2.ean_emplacement = em2.id WHERE em2.id = e.id AND em2.code LIKE "%5056208812636%") > 0) ORDER BY e.id desc LIMIT 0, 10;

Using version 10.3.25 and 10.1. 48 : 1 row in set (0.229 sec)
Using version more than 10.3.25 : 1 row in set (1.414 sec)



 Comments   
Comment by wareteamflo [ 2022-09-14 ]

Bug appear at exactly 10.3.29.
10.3.28 not affected by latency.

Comment by wareteamflo [ 2022-09-15 ]

Another querry latency :

SELECT DATE_FORMAT(l0_.date_mouvement, '%Y-%m-%d') AS sclr_0, SUM(l0_.stock_attente_entrepot) AS sclr_1, SUM(l0_.stock_entrepot) AS sclr_2, SUM(l0_.stock_camion) AS sclr_3, SUM(l0_.stock_client) AS sclr_4, l0_.info AS info_5, l0_.date_mouvement AS date_mouvement_6, (SELECT (l1_.stock_instant_t) FROM log_mouvement_stock l1_ LEFT JOIN materiel m2_ ON l1_.materiel_id = m2_.id AND m2_.discr IN ('materiel') WHERE DATE_FORMAT(l0_.date_mouvement, '%Y-%m-%d') = DATE_FORMAT(l1_.date_mouvement, '%Y-%m-%d') AND l0_.info = l1_.info AND m2_.id = m3_.id AND MAX(l0_.id) = l1_.id ORDER BY l1_.date_mouvement DESC) AS sclr_7 FROM log_mouvement_stock l0_ LEFT JOIN materiel m3_ ON l0_.materiel_id = m3_.id AND m3_.discr IN ('materiel') WHERE m3_.id LIKE '19118' GROUP BY sclr_0, l0_.info ORDER BY l0_.id DESC;

Comment by Alice Sherepa [ 2022-09-16 ]

Is it possible for you to add a dump with the involved tables? And EXPLAIN for the query (in both versions)

Generated at Thu Feb 08 10:09:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.