There's nothing wrong with using MySQL aslong as you filter all input. Personally, I've started using MySQLi for the security functionalities(binding) it has, unlike others such as Cobe who just use it like if it was an object-oriented style of MySQL and don't use all of its potential.
If you control the amount of queries being run at one time. You don't need to enhance the way you code your queries or how MySQL operates and obviously it matters how you create the queries..Learn more about caching in general and such to keep the systems running cooler then the breeze :)
No, if you've seen Cobe's MySQLi class, you could see he prepares the query before executing, right?
Well, he doesn't really have a reason to prepare the query, since he isn't doing any further operations to the statement.
He should just do execute() and it'd be fine.
By binding I mean binding the parameters.
Example:
PHP Code:<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_database');
$stmt = $mysqli->prepare("INSERT INTO users VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param('isssi', $id, $username, $password, $email, $credits);
$id = 1;
$username = "Kryptos";
$password = "783749374035RJFFMRMCUBRR894579";
$email = "kryptos@yopimpdaddy.com";
$credits = 1337;
$stmt->execute();
printf("%i Row inserted.\n", $stmt->affected_rows);
$stmt->close();
PHP: func_get_args - Manual
After doing some reseasch, it almost doesn't matter how manny queries you do.
I runned 200 queries and refreshed it for like 10 min.
There was no overload in the mysql server and it didn't slow down the load time, Thank you
I don't think you fully understand. Unless you have an SSD drive, The HDD is the slowest component inside your computer/server. And where is MySQL data read/written to? Yeah, your disk. Therefore MySQL (unless on a SSD) will become a bottle neck in any application. But even on an SSD it can slow down during transitions.
You should cache everything you can - when you can. Memory is faster than reading from the HDD. You also want MySQL to do more important tasks than re-query everything on a page load.
It's logical sense, also the less reading/writing a HDD has to do the longer life span it has.
Therefore caching is both the best, cheapest and most scalable solution.
Also to add, that's 200 queries. Let's try over 1000 per second.. and lets see what happens then..
Less queries the faster the site is? ;3
Raid 0 (HDD):
It isn't that bad.Code:1 => 0.360518 sec 2 => 0.630954 sec 3 => 0.367923 sec 4 => 0.634839 sec 5 => 0.36757 sec 6 => 0.627775 sec 7 => 0.368542 sec 8 => 0.642663 sec 9 => 0.366623 sec 10 => 0.659323 sec ------------------ Total: 5.02673 sec Queries: 10000
1000 queries per page![]()