Discussion:
[patch #6572] A test on using PDO in db-class
Sigurd Nes
2008-07-17 21:50:30 UTC
Permalink
Hi all,

I did a test on using PDO for db-connection.
The code is based on the current db-class from trunk and the tutorial found at:
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html

Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).

The class is not 100% complete - but most of it works.

http://savannah.gnu.org/patch/download.php?file_id=16131

What do you think ?


Regards

Sigurd
Maât
2008-07-18 06:17:31 UTC
Permalink
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
nice try !

thanks Sigurd :)

Maât
Sigurd Nes
2008-07-18 11:58:29 UTC
Permalink
Sent: 2008-07-18 08:17:31 CEST
Subject: Re: [phpGroupWare-developers] [patch #6572] A test on using PDO in db-class
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
nice try !
thanks Sigurd :)
I think we also could have a look at Prepared Queries - maybe something as the second example on this page:
http://www.devshed.com/c/a/PHP/Working-with-Prepared-Queries-with-PDO-Objects-in-PHP-5/2/

Regards

Sigurd
Sigurd Nes
2008-07-18 22:44:01 UTC
Permalink
Post by Sigurd Nes
Sent: 2008-07-18 08:17:31 CEST
Subject: Re: [phpGroupWare-developers] [patch #6572] A test on using PDO in db-class
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
nice try !
thanks Sigurd :)
http://www.devshed.com/c/a/PHP/Working-with-Prepared-Queries-with-PDO-Objects-in-PHP-5/2/
The class is updated to handle prepared prepared statements for insert and
select (function insert() and function select())

Might be good for preventing sql-injections.

The test include test on FETCH_ASSOC and FETCH_BOTH - seems to make no
difference in performance (speed).


Regards

Sigurd
Sigurd Nes
2008-07-19 15:25:26 UTC
Permalink
Post by Sigurd Nes
Post by Sigurd Nes
Sent: 2008-07-18 08:17:31 CEST
Subject: Re: [phpGroupWare-developers] [patch #6572] A test on using PDO in db-class
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
nice try !
thanks Sigurd :)
http://www.devshed.com/c/a/PHP/Working-with-Prepared-Queries-with-PDO-Objects-in-PHP-5/2/
The class is updated to handle prepared prepared statements for insert and
select (function insert() and function select())
Might be good for preventing sql-injections.
The test include test on FETCH_ASSOC and FETCH_BOTH - seems to make no
difference in performance (speed).
I have finished the porting of the db-class from adodb to pdo (except for some
meta functions - which still calls adodb).

It is faster - and it support prepared statements for insert and select.

https://savannah.gnu.org/patch/download.php?file_id=16157

I have also done a test conversion to the rest of the system - and there is
minor changes to functions.inc.php and class.applications.inc.php to make it work.

What do you think?

Regards

Sigurd
Sigurd Nes
2008-07-19 15:34:09 UTC
Permalink
updated file:
https://savannah.gnu.org/patch/download.php?file_id=16158
Sigurd Nes
2008-08-19 10:53:58 UTC
Permalink
Any interest in the super-quick PDO-version of the db-class?
http://savannah.gnu.org/patch/index.php?6572

Regards

Sigurd.

Sent from the phpGroupWare forums @ forums.phpGroupWare.org
Sigurd Nes
2008-08-19 16:44:26 UTC
Permalink
Post by Sigurd Nes
Any interest in the super-quick PDO-version of the db-class?
http://savannah.gnu.org/patch/index.php?6572
Follow up:
Looks like PDO is preventing sql-injections as it does not allows multiple
statementents in a single query.

Example:
'SELECT * FROM table1; DELETE FROM table2' - will fail with a 'cannot insert
multiple commands into a prepared statement' even though it is not a prepared
statement.


Regards

Sigurd
Sigurd Nes
2008-08-20 19:41:32 UTC
Permalink
Hi all,

There has been no objections on the PDO approach since the idea was first
mentioned a month ago - and it is safer and quicker than adodb.

Is it ok for me to implement it?

http://savannah.gnu.org/patch/index.php?6572

Regards

Sigurd

Dave Hall
2008-07-18 09:23:24 UTC
Permalink
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
Please post the test cases used to generate these stats so they can be
verified.

Cheers

Dave
Sigurd Nes
2008-07-18 11:50:10 UTC
Permalink
Sent: 2008-07-18 11:23:24 CEST
Subject: Re: [phpGroupWare-developers] [patch #6572] A test on using PDO in db-class
Post by Sigurd Nes
Hi all,
I did a test on using PDO for db-connection.
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
Seems like it is about 5 % faster on reading and 20 % faster on writing compared
to adodb with eaccelerator (had hoped for more).
The class is not 100% complete - but most of it works.
http://savannah.gnu.org/patch/download.php?file_id=16131
What do you think ?
Please post the test cases used to generate these stats so they can be
verified.
Yep - it is faster:

100.000 inserts and selects levels out on 14 sec and 3,5 sec for PDO and 21 sec and 6 sec for ADOdb.

That is 33% faster on insert and 42 % faster on select

See attachment to try it your self

Regards

Sigurd
Loading...