Performance issues with PHP/Oracle/PDO – PHP

  php

Q(Question):

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();
}

A(Answer):

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
==================

A(Answer):

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.

A(Answer):

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.

A(Answer):

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
==================

A(Answer):

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
==================

A(Answer):

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.

LEAVE A COMMENT