473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Performance issues with PHP/Oracle/PDO

How can I make these inserts faster?
$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
for($idx=0; $idx<count($lines); $idx++) {
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid", $_SESSION["employee_number"]);
$stmt->execute();
}
Nov 3 '08 #1
6 3081
Anthony Smith wrote:
How can I make these inserts faster?
$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
for($idx=0; $idx<count($lines); $idx++) {
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid", $_SESSION["employee_number"]);
$stmt->execute();
}
How much faster do you need them? From the PHP end, you aren't going to
be able to gain a whole lot more performance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 3 '08 #2
On Nov 3, 2:09*pm, Anthony Smith <mrsmi...@hotmail.comwrote:
How can I make these inserts faster?

* * * * * * * * $insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
* * * * * * * * * * * * * * * * "(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
* * * * * * * * * * * * * * * * " values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

* * * * * * * * $stmt = $con->prepare($insert);
* * * * * * * * for($idx=0; $idx<count($lines); $idx++){

* * * * * * * * * * * * $items = explode($token, trim($lines[$idx]));
* * * * * * * * * * * * $stmt->bindParam(":acct",$items[0]);
* * * * * * * * * * * * $stmt->bindParam(":region", $items[1]);
* * * * * * * * * * * * $stmt->bindParam(":origin", $items[2]);
* * * * * * * * * * * * $stmt->bindParam(":territory", $items[3]);
* * * * * * * * * * * * $stmt->bindParam(":half",$_SESSION["half"]);
* * * * * * * * * * * * $stmt->bindParam(":year",$_SESSION["year"]);
* * * * * * * * * * * * $stmt->bindParam(":userid", $_SESSION["employee_number"]);
* * * * * * * * * * * * $stmt->execute();
* * * * }
My proxy is timing out. I am thinking there is one change that maybe
can be made to solved this issue.
Nov 3 '08 #3
Is there a connection cache feature on Apache side or PHP/Oracle connect
call?

Anthony Smith wrote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
>How can I make these inserts faster?

$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
for($idx=0; $idx<count($lines); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid", $_SESSION["employee_number"]);
$stmt->execute();
}

My proxy is timing out. I am thinking there is one change that maybe
can be made to solved this issue.
Nov 3 '08 #4
Anthony Smith wrote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
>How can I make these inserts faster?

$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
for($idx=0; $idx<count($lines); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid", $_SESSION["employee_number"]);
$stmt->execute();
}

My proxy is timing out. I am thinking there is one change that maybe
can be made to solved this issue.
How many updates are you trying to do? And how long does it take for
the connection to time out?

My thoughts are that this is not where your problem lies.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 4 '08 #5
MacRules wrote:
Anthony Smith wrote:
>On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
>>How can I make these inserts faster?

$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD,
ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
for($idx=0; $idx<count($lines); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid",
$_SESSION["employee_number"]);
$stmt->execute();
}

My proxy is timing out. I am thinking there is one change that maybe
can be made to solved this issue.

Is there a connection cache feature on Apache side or PHP/Oracle
connect call?
(Top posting fixed)

Which does absolutely nothing to solve this problem. He's only making
one connection, and making the connection won't take that much time.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 4 '08 #6
On 3 Nov, 20:35, Anthony Smith <mrsmi...@hotmail.comwrote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
How can I make these inserts faster?
<snip>
My proxy is timing out. I am thinking there is one change that maybe
can be made to solved this issue.
Don't use Oracle?

If you don't have a code profiler / debugger installed, try running a
test harness from the CLI to identify where its going slow:

function report($msg)
{
static $started;
if (!$started) $started=microtime(true);
print $msg . " at time " . microtime(true) - $started . " s \n";
flush();
}

$base=microtime(true);
report('start');
$con=new PDO(....);
report('connected');
$insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " .
"(KIAC_ACCT_NBR, REGION_CD,
ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($insert);
report("prepared");
for($idx=0; $idx<count($lines); $idx++) {
report("line $idx started");
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":acct", $items[0]);
$stmt->bindParam(":region", $items[1]);
$stmt->bindParam(":origin", $items[2]);
$stmt->bindParam(":territory", $items[3]);
$stmt->bindParam(":half", $_SESSION["half"]);
$stmt->bindParam(":year", $_SESSION["year"]);
$stmt->bindParam(":userid",
$_SESSION["employee_number"]);
report("line $idx about to submit");
$stmt->execute();
report("executed");
}
C.
Nov 4 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pat Alessi | last post by:
Hi. I have a query that runs in about 2 Seconds in oracle and retrieves 4000 rows. However, when I time the ocifetchstatement in PHP, it is taking about 15 seconds to execute. The web server and...
5
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
2
by: Andras Kovacs | last post by:
We have a performance problem to replicate our environnement. Our java code is able to insert 100 000 rows in a table within 3 seconds using Batch Statement. For two oracle sites it takes 6...
2
by: Seung Y. Kim | last post by:
Hi everyone. I am having a big performance issue with my ASP application with Oracle database. The application itself is a very database-generic one, so I can switch from Access to SQLServer...
11
by: Dave [Hawk-Systems] | last post by:
have the table "numbercheck" Attribute | Type | Modifier -----------+------------+---------- svcnumber | integer | not null svcqual | varchar(9) | svcequip | char(1) | svctroub ...
5
by: mjan | last post by:
Hello, could you please advice on how to measure replication performance in Oracle, DB2 & MS SQL Server RDBMS installed in Windows servers ? I've got two servers with databases installed and...
1
by: david williams | last post by:
I have been experiencing performance issues on doing a simple query in an ORACLE relational database which more than 200 million record s (spans 34 years of data). The query just lists record...
2
by: manindra | last post by:
Recently we migrated our product from MS-SQL 2000 to Oracle 9i. We see lot of performance degradation due to migration. Some times complex queries are hitting 10 fold slower than SQL Server. ...
0
by: aberton | last post by:
Hi all, I am having major performance issues between my linked server and an Oracle10 db. I have created a number of views in my SQL Server database which map to corresponding Oracle tables via a...
0
by: aberton | last post by:
Hi all, I am having major performance issues between my linked server (SQL Server) and an Oracle10 db. I have created a number of views in my SQL Server database which map to corresponding Oracle...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.