Zen Cart Logo
Forums / All Other Contributions/Addons / Bug found in URI Mapping CEON

Bug found in URI Mapping CEON

Views: 919

Results 1 to 1 of 1
11 Jun 2011, 7:12 PM
#1
fawad123 avatar

fawad123

New Zenner

Join Date:
Oct 2009
Posts:
93
Plugin Contributions:
0

Bug found in URI Mapping CEON

I have been trying to optimize my site by optimizing sql queries generated by uri mapping. I have used "General Query Log' to analyze repetitive queries.
I just found the following query twice for each product listing whenever I browse through product listing page.

1 Query       SELECT
              uri
            FROM
              zen_ceon_uri_mappings
            WHERE
              main_page = 'document_product_info'
            AND
              associated_db_id = '30353'
            AND
              language_id = '1'
            AND
              current_uri = '1'
		      1 Query       select p2c.categories_id
                       from zen_products p, zen_products_to_categories p2c
                       where p.products_id = '30353'
                       and p.products_status = '1'
                       and p.products_id = p2c.products_id limit 1
		      1 Query       select products_description
                      from zen_products_description
                      where products_id = '30353'
                      and language_id = '1'
		      1 Query       select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from zen_products where products_id = '30353' limit 1

------------------------------------------------------------------
		      1 Query       SELECT
              uri
            FROM
              zen_ceon_uri_mappings
            WHERE
              main_page = 'document_product_info'
            AND
              associated_db_id = '30353'
            AND
              language_id = '1'
            AND
              current_uri = '1'
		      1 Query       select p2c.categories_id
                       from zen_products p, zen_products_to_categories p2c
                       where p.products_id = '30353'
                       and p.products_status = '1'
                       and p.products_id = p2c.products_id limit 1
		      1 Query       SELECT
              uri
            FROM
              zen_ceon_uri_mappings
            WHERE
              main_page = 'document_product_info'
            AND
              associated_db_id = '30353'
            AND
              language_id = '1'
            AND
              current_uri = '1'
		      1 Query       select p2c.categories_id
                       from zen_products p, zen_products_to_categories p2c
                       where p.products_id = '30353'
                       and p.products_status = '1'
                       and p.products_id = p2c.products_id limit 1

If you see these four queries can be cut down by just one query through Join or Union.

Is there any suggestion how to optimize this code?

Thanks.