[TYPO3-commerce] Huge number of queries
Ingo Schmitt
spam at marketing-factory.de
Tue Aug 19 11:57:04 CEST 2008
Hi,
> i have page that list 20 products
> each product has 20 articles (color/size combination)
> each article has price
>
> let's calculate
>
> 20 queries to get products
> 20*20 = 400 queries to get articles
> 400 queries to get prices
> 400 queries to attributes
>
>
> there are a lot of queries for moneylib and DeliveryCost but they are
> the same and query cache handles them.
>
> so we have 1220 unique queries. pretty nice.
>
> in ideal world it should takes 4 queries i think
> select all products where (category = N)
> select all articles where (uid_product = P1 OR uid_product = P2 ...)
> select all prices where (uid_article = A1 OR uid_article = A2 ...)
> select all attributes where (uid_article = A1 OR uid_article = A2)
>
I Don't think this could be a real solution, since you need the
relations of the articles to the products, the prices to the articles
and the attributes to the articles and products. In your way, you have
to load all this data in array and select the data you need by checking
each element of an array.
See my example for the articles
foreach ($products as $oneProduct) {
// detect article to the product
$productUid = $oneProcut['uid'];
foreach ($articles as $oneArticle) {
if ($ineArticle['uid_product'] == $productUid) {
// Render output
}
}
}
Not quite a solution, or?
Ingo
> i have special page in shop that display 80 products. Page crashes
> with timeout (more then 30sec)
>
Mit freundlichen Gruessen
--
Ingo Schmitt mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung
More information about the TYPO3-project-commerce
mailing list