Connecting Tech Pros Worldwide Help | Site Map

Performance issues with PHP/Oracle/PDO

Anthony Smith
Guest
 
Posts: n/a
#1: Nov 3 '08
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();
}
Jerry Stuckle
Guest
 
Posts: n/a
#2: Nov 3 '08

re: Performance issues with PHP/Oracle/PDO


Anthony Smith wrote:
Quote:
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.
jstucklex@attglobal.net
==================

Anthony Smith
Guest
 
Posts: n/a
#3: Nov 3 '08

re: Performance issues with PHP/Oracle/PDO


On Nov 3, 2:09*pm, Anthony Smith <mrsmi...@hotmail.comwrote:
Quote:
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.
MacRules
Guest
 
Posts: n/a
#4: Nov 3 '08

re: Performance issues with PHP/Oracle/PDO


Is there a connection cache feature on Apache side or PHP/Oracle connect
call?

Anthony Smith wrote:
Quote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
Quote:
>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.
Jerry Stuckle
Guest
 
Posts: n/a
#5: Nov 4 '08

re: Performance issues with PHP/Oracle/PDO


Anthony Smith wrote:
Quote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
Quote:
>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.
jstucklex@attglobal.net
==================

Jerry Stuckle
Guest
 
Posts: n/a
#6: Nov 4 '08

re: Performance issues with PHP/Oracle/PDO


MacRules wrote:
Quote:
Anthony Smith wrote:
Quote:
>On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
Quote:
>>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.
jstucklex@attglobal.net
==================

C. (http://symcbean.blogspot.com/)
Guest
 
Posts: n/a
#7: Nov 4 '08

re: Performance issues with PHP/Oracle/PDO


On 3 Nov, 20:35, Anthony Smith <mrsmi...@hotmail.comwrote:
Quote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotmail.comwrote:
>
>
>
Quote:
How can I make these inserts faster?
>
<snip>
Quote:
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.
Closed Thread