A
A
Alexander2016-12-13 20:20:49
PHP
Alexander, 2016-12-13 20:20:49

How fast is PDO?

Started a new project and finally decided to move from mysql_ to PDO. After a day of working with him, I got the impression that he was very slow, I tested on simple queries like:

$selectUser = $pdo->query('SELECT * FROM admin');
$selectUser = $selectUser->fetch();

It seems to me or is it really slower?
UPD: For those who wanted to see numbers:
PDO - 0.00030599999999996
mysql_: 0.00011000000000006

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
ThunderCat, 2016-12-13
@SmoKE_xD

Here is a good article for beginners, read the comments, there are a lot of reviews and use cases people brought, the main idea is that pdo is initially object-oriented and has prepared statements. It is a) convenient b) safe. All other pipiskomeryalki in projects like "my second improved blog in php" do not make sense. For the gain in speed of development/security is more important today than microadvantages from change of the driver to a DB.

A
Anton Shamanov, 2016-12-13
@SilenceOfWinter

Of course, it is slower, this comes from the very principle of its work. But who is stopping you from implementing caching?

A
asd111, 2016-12-13
@asd111

You can start with the fact that mysql_the functions have been removed from php, as far as I understand, since version 5.5, and only mysqli_analogues that are not faster than PDO remain. And the rest I think you have already learned from other answers.

L
Lumore, 2017-04-25
@Lumore

Open the console, there may be an error there. You can also see Network, in the same developer panel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question