Page 1 of 1
Does database influence page load?
Posted: Sun Nov 27, 2011 2:50 pm
by amirbwb
Hello,
I want to know if I am doing a list of students, which are executed from database (mysql),
does the number of data influence in the speed of the page load?
if yes:
What to do ?
And for how much data should I start to think for a solution ?
Thank you
Re: Does database influence page load?
Posted: Sun Nov 27, 2011 2:56 pm
by maxx99
Yep, number of records has an impact on page load time.... but...
If its just a simple SELECT query you don't need to worry. MySQL can easily handle millions of records

On some point you may have to paginate the list to reduce data send between web server and user on every request.
Here's an example
http://www.sitepoint.com/perfect-php-pagination/
Re: Does database influence page load?
Posted: Sun Nov 27, 2011 3:27 pm
by amirbwb
Thank you maxxx99, I have done a pagination, but even if I use the pagination i will include in my code to: select * from TABLE, which will get all data to count them

than I will use the select * from TABLE LIMIT $a,$b or whatever ...
And Yes am using mysql, and am talking about not more than 50 000 data in the students list (the table executed using pagination, but calling all student to count them all is required to make the math logic for the pagination)
tic toc tic toc
Hope I explained correctly =) THANK YOU AGAIN ^^
Re: Does database influence page load?
Posted: Sun Nov 27, 2011 9:25 pm
by Celauran
You really shouldn't use SELECT *, well, ever. Certainly not for counting the number of records.
Re: Does database influence page load?
Posted: Sun Nov 27, 2011 9:39 pm
by McInfo
amirbwb wrote:[...] i will include in my code to: select * from TABLE, which will get all data to count them [...]
Code: Select all
SELECT COUNT(*) AS `num_rows` FROM `my_table`
Re: Does database influence page load?
Posted: Mon Nov 28, 2011 1:22 am
by maxx99
Exec another query as McInfo proposed, this will count all of the records for you on db side

no need to fetch whole db
Re: Does database influence page load?
Posted: Wed Nov 30, 2011 3:19 am
by amirbwb
mm thank you both ...