Skip to main content
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Web Architecture : Education - Tutorials
Writing efficient PHP
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
4. Optimizing database queries

Eliminating or reducing duplicate requests for the same data page 5 of 8

When you process many records from a database, especially those cross-referenced with another database, try to modify the code to eliminate -- or at least reduce -- duplicate requests for the same data.

For example, you generate a detailed sales report from a database that contains only product numbers and actual sales. In the report you also need to display the corresponding product names that are maintained in a different database. You may be able to implement a basic caching mechanism so the product names are only retrieved once for each product number.

This approach will consume more memory. But, depending on your specific data set, it also can make a significant impact on the total amount of time spent reading data.

Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact