4 years ago
0
Topic

Hi

is there a way to get rid of the double query that is performed on each seblod list please

Here is an example :

SELECT t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.author_session AS author_session,t0.cck AS cck,t0.storage_location AS loc,tt.id AS type_id,tt.alias AS type_alias
FROM `#__cck_core` AS t0
LEFT JOIN `#__cck_store_form_produit` AS t1 ON t1.id = t0.pk
LEFT JOIN `#__content` AS t2 ON t2.id = t0.pk
LEFT JOIN `#__cck_core_types` AS tt ON tt.name = t0.cck
WHERE t2.state = 1
AND t2.access IN (1,1,5,12)
AND ( t2.publish_up = '0000-00-00 00:00:00' OR t2.publish_up <= '2020-01-20 18:17' )
AND ( t2.publish_down = '0000-00-00 00:00:00' OR t2.publish_down >= '2020-01-20 18:17' )
AND t0.cck = 'produit'
AND ((t1.pr_produit_marque = '239295' OR t1.pr_produit_marque LIKE '239295,%' OR t1.pr_produit_marque LIKE '%,239295,%' OR t1.pr_produit_marque LIKE '%,239295'))
AND t2.catid = 10
ORDER BY t2.title ASC
LIMIT 25

SELECT COUNT(t0.id)
FROM `#__cck_core` AS t0
LEFT JOIN `#__cck_store_form_produit` AS t1 ON t1.id = t0.pk
LEFT JOIN `#__content` AS t2 ON t2.id = t0.pk
LEFT JOIN `#__cck_core_types` AS tt ON tt.name = t0.cck
WHERE t2.state = 1
AND t2.access IN (1,1,5,12)
AND ( t2.publish_up = '0000-00-00 00:00:00' OR t2.publish_up <= '2020-01-20 18:17' )
AND ( t2.publish_down = '0000-00-00 00:00:00' OR t2.publish_down >= '2020-01-20 18:17' )
AND t0.cck = 'produit'
AND ((t1.pr_produit_marque = '239295' OR t1.pr_produit_marque LIKE '239295,%' OR t1.pr_produit_marque LIKE '%,239295,%' OR t1.pr_produit_marque LIKE '%,239295'))
AND t2.catid = 10

the second SELECT is only here to count the number of items. why? it doubles the computation time. It is invisible on small sites but with 200 000+ items you pretty feel the weigth of it.

Thanks

Cyril

Get a Book for SEBLOD