mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #24403
[Bug 1427046] [NEW] Improving ADODB speed
Public bug reported:
To make ADODB function faster I found the following information:
----------------------------------------------------------------------------------------------
High Speed ADOdb
ADOdb is a big class library, yet it consistently beats all other PHP class libraries in performance. This is because it is designed in a layered fashion, like an onion, with the fastest functions in the innermost layer. Stick to the following functions for best performance:
Innermost Layer
Connect, PConnect, NConnect
Execute, CacheExecute
SelectLimit, CacheSelectLimit
MoveNext, Close
qstr, Affected_Rows, Insert_ID
The fastest way to access the fields is by accessing the array
$recordset->fields directly. Also set the global variables
$ADODB_FETCH_MODE = ADODB_FETCH_NUM, and $ADODB_COUNTRECS = false before
you connect to your database.
Consider using bind parameters if your database supports it, as it
improves query plan reuse. Use ADOdb's performance tuning system to
identify bottlenecks quickly.
Installing the ADOdb C extension will speed up GetAll() and GetArray()
by 100%, and GetAssoc() by 30%. It will also speed up oci8 select
statements by 30%.
Lastly make sure you have a PHP accelerator cache installed such as APC,
Turck MMCache, Zend Accelerator or ionCube.
Advanced Tips
If you have the ADOdb C extension installed, you can replace your calls
to $rs->MoveNext() with adodb_movenext($rs). This doubles the speed of
this operation. For retrieving entire recordsets at once, use
GetArray(), which uses the high speed extension function adodb_getall()
internally.
Execute() is the default way to run queries. You can use the low-level
functions _Execute() and _query() to reduce query overhead. Both these
functions share the same parameters as Execute().
If you do not have any bind parameters or your database supports binding
(without emulation), then you can call _Execute() directly. Calling this
function bypasses bind emulation. Debugging is still supported in
_Execute().
If you do not require debugging facilities nor emulated binding, and do
not require a recordset to be returned, then you can call _query. This
is great for inserts, updates and deletes. Calling this function
bypasses emulated binding, debugging, and recordset handling. Either the
resultid, true or false are returned by _query().
** Affects: mahara
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1427046
Title:
Improving ADODB speed
Status in Mahara ePortfolio:
New
Bug description:
To make ADODB function faster I found the following information:
----------------------------------------------------------------------------------------------
High Speed ADOdb
ADOdb is a big class library, yet it consistently beats all other PHP class libraries in performance. This is because it is designed in a layered fashion, like an onion, with the fastest functions in the innermost layer. Stick to the following functions for best performance:
Innermost Layer
Connect, PConnect, NConnect
Execute, CacheExecute
SelectLimit, CacheSelectLimit
MoveNext, Close
qstr, Affected_Rows, Insert_ID
The fastest way to access the fields is by accessing the array
$recordset->fields directly. Also set the global variables
$ADODB_FETCH_MODE = ADODB_FETCH_NUM, and $ADODB_COUNTRECS = false
before you connect to your database.
Consider using bind parameters if your database supports it, as it
improves query plan reuse. Use ADOdb's performance tuning system to
identify bottlenecks quickly.
Installing the ADOdb C extension will speed up GetAll() and GetArray()
by 100%, and GetAssoc() by 30%. It will also speed up oci8 select
statements by 30%.
Lastly make sure you have a PHP accelerator cache installed such as
APC, Turck MMCache, Zend Accelerator or ionCube.
Advanced Tips
If you have the ADOdb C extension installed, you can replace your
calls to $rs->MoveNext() with adodb_movenext($rs). This doubles the
speed of this operation. For retrieving entire recordsets at once, use
GetArray(), which uses the high speed extension function
adodb_getall() internally.
Execute() is the default way to run queries. You can use the low-level
functions _Execute() and _query() to reduce query overhead. Both these
functions share the same parameters as Execute().
If you do not have any bind parameters or your database supports
binding (without emulation), then you can call _Execute() directly.
Calling this function bypasses bind emulation. Debugging is still
supported in _Execute().
If you do not require debugging facilities nor emulated binding, and
do not require a recordset to be returned, then you can call _query.
This is great for inserts, updates and deletes. Calling this function
bypasses emulated binding, debugging, and recordset handling. Either
the resultid, true or false are returned by _query().
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1427046/+subscriptions
Follow ups
References