Requete de comptage personnalisée

More
10 years 11 months ago #43077 by juansolos
Bonjour,
j'utilise jumi pour insérer du php.
Ce code php compte les items flexicontent qui ont la valeur V pour le champs C.
Plusieurs scripts php sont appelé dans la page avec une valeur V différentes pour ce même champs.

La requête n'est peut être pas optimisée. Car la page met énormément de temps à se charger.
Une aide?
une requete :
Code:
$db = JFactory::getDbo(); $sql = "SELECT COUNT(distinct o.item_id) FROM #__flexicontent_fields_item_relations as o" ." INNER JOIN #__content as c" . ' WHERE o.field_id = "C" AND (o.value = "V1") AND c.state="1"'; $db->setQuery($sql); $result = $db->loadResult();

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #43084 by juansolos
Celle ci serait elle plus rapide.
Qu'en pensez vous?
Code:
$sql = 'SELECT COUNT(distinct c.id) FROM #__content AS c ' .' JOIN #__flexicontent_fields_item_relations as o ' .' ON c.id=o.item_id AND o.field_id = "C" AND c.state="1" ' . ' WHERE o.value = "V1"';

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #43085 by ggppdk
Hello

did you measure time to execute this query ?

you execute it more than once in the same page ?

about page execution time, did you also try to print performance statistics ? (enable in FLEXIcontent component parameter, at the first tab near the top)
-- note the time need for this query maybe include in the "template rendering" part


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #43086 by juansolos
Hello,
i execute this query around 30 times in the page, the page isn't a flexicontent page.

What do you think about the 2 queries above?

Regards

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.344 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline