0

When i am filtering mysql results using php programming, the webpage is taking too much time to load (approx 30-40 secs) when results are getting more than 1000. How can i reduce the loading time to as minimum as i can ?

3 Answers3

0

If your query use a WHERE clause, you might want to index your table on the columns used as WHERE criteria to allow faster retrieval.

Learn more about it.

Community
  • 1
  • 1
Aaron
  • 24,009
  • 2
  • 33
  • 57
0

What about using views? The view will be updated and have the latest data. Then you select * from the view rather than joining on the original table.

As per other answers, indexing on the fields you use for filtering and joining should speed up the process. These are also nice to have when you are using views (they will update faster).

Finally, try to do everything in the database, ie do not loop the results in PHP.

urban
  • 5,392
  • 3
  • 19
  • 45
0

If you want only limited results (that can save time), then use

select * from table as RANDOM LIMIT 500
Thomas N T
  • 459
  • 1
  • 3
  • 14