Would my site cause a SQL overload in the future?

Hi! I am making a home inventory app with PHP and SQL.
I was wondering in case if any SQL overload would happen to my site.
Usually, my app performs ~35 SQL queries when the app loads.
Example (Here is what each query looks like):

try {
      $dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
      $sql = "SELECT * FROM kitchen WHERE login_id=".$_SESSION['id']." OR login_id= ".$_SESSION['syncid'];
      $users = $dbh->query($sql);
      //This isn't the complete code, I truncated the rest of it
//  Rest of my app........

Unfortunately, all of these queries are vital to keep this app running.
Keep in mind that this app is a single page app.
Users only need to load this page once.

So, would my site cause a SQL overload in the future?

Yes…if you have a lot of users.

1 Like

How many might that be? 100 - 200?
Currently I have ~40 users

I actually once put the mysqli select method into a loop (suddenly) and it didn’t suspend.
It might not always depend on how many users you have, but how much data you select from them or how many queries you run in every page reload.


Probably not.

Although I would suggest to add an index to the login_id column. If the table grows very large, not having an index on a column you filter on a lot means the database server has to scan the entire table to find the row. This will hurt query performance a lot and cause high server load.


Thanks for the suggestion! I should try this out!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.