Magento code optimization techniques

1. Enable Flat Categories and Products.

In Magento admin, (top menu) System > Configuration, (left nav) Catalog > Catalog, (main page) Frontend.  Set “Use Flat Catalog Category” and “Use Flat Catalog Product” to “Yes“.

2. Merge CSS and JS Files 

   In Magento admin, (top menu) System > Configuration, (left nav) Advanced > Developer, (main page) JavaScript Settings, CSS Settings. Set “Merge Javascript” Files and “Merge CSS” Files to “Yes”.

3. Enable Compilation. 

In Magento admin, (top menu) System > Tools > Compilation, click Enable.

4. Caching Magento

go to System > Cache Management. Select all items, set the Action dropdown to “Enable” then hit Submit

5. Enable GZip Compression.

6. Configure mod_expires Apache Module

7. Speed up Magento by Clean database log 

The following tables are managed by Magento’s Log Cleaning function:
 
log_customer
log_visitor
log_visitor_info
log_url
log_url_info
log_quote
report_viewed_product_index
report_compared_product_index
report_event
catalog_compare_item
 
Let ‘s execute this SQL to clear and optimize them
 
SET foreign_key_checks = 0;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;
TRUNCATE catalog_compare_item;
SET foreign_key_checks = 1;