473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance issues with PHP/Oracle/PDO

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

$stmt = $con->prepare($inser t);
for($idx=0; $idx<count($lin es); $idx++) {
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid", $_SESSION["employee_numbe r"]);
$stmt->execute();
}
Nov 3 '08 #1
6 3104
Anthony Smith wrote:
How can I make these inserts faster?
$insert = "INSERT into AFF_KIAC_ACCT_A LIGNMENT " .
"(KIAC_ACCT_NBR , REGION_CD, ORIGIN_LOC_CD,T ERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($inser t);
for($idx=0; $idx<count($lin es); $idx++) {
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid", $_SESSION["employee_numbe r"]);
$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*******@attgl obal.net
=============== ===

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

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

* * * * * * * * $stmt = $con->prepare($inser t);
* * * * * * * * for($idx=0; $idx<count($lin es); $idx++){

* * * * * * * * * * * * $items = explode($token, trim($lines[$idx]));
* * * * * * * * * * * * $stmt->bindParam(":ac ct",$items[0]);
* * * * * * * * * * * * $stmt->bindParam(":re gion", $items[1]);
* * * * * * * * * * * * $stmt->bindParam(":or igin", $items[2]);
* * * * * * * * * * * * $stmt->bindParam(":te rritory", $items[3]);
* * * * * * * * * * * * $stmt->bindParam(":ha lf",$_SESSION["half"]);
* * * * * * * * * * * * $stmt->bindParam(":ye ar",$_SESSION["year"]);
* * * * * * * * * * * * $stmt->bindParam(":us erid", $_SESSION["employee_numbe r"]);
* * * * * * * * * * * * $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...@hotma il.comwrote:
>How can I make these inserts faster?

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

$stmt = $con->prepare($inser t);
for($idx=0; $idx<count($lin es); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid", $_SESSION["employee_numbe r"]);
$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...@hotma il.comwrote:
>How can I make these inserts faster?

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

$stmt = $con->prepare($inser t);
for($idx=0; $idx<count($lin es); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid", $_SESSION["employee_numbe r"]);
$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*******@attgl obal.net
=============== ===

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

$insert = "INSERT into AFF_KIAC_ACCT_A LIGNMENT " .
"(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($inser t);
for($idx=0; $idx<count($lin es); $idx++) {

$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid",
$_SESSION["employee_numbe r"]);
$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*******@attgl obal.net
=============== ===

Nov 4 '08 #6
On 3 Nov, 20:35, Anthony Smith <mrsmi...@hotma il.comwrote:
On Nov 3, 2:09 pm, Anthony Smith <mrsmi...@hotma il.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=microt ime(true);
print $msg . " at time " . microtime(true) - $started . " s \n";
flush();
}

$base=microtime (true);
report('start') ;
$con=new PDO(....);
report('connect ed');
$insert = "INSERT into AFF_KIAC_ACCT_A LIGNMENT " .
"(KIAC_ACCT_NBR , REGION_CD,
ORIGIN_LOC_CD,T ERRITORY, FISCAL_HALF,
FISCAL_YEAR, MAINT_USER_ID)" .
" values
(:acct, :region, :origin, :territory, :half, :year, :userid)";

$stmt = $con->prepare($inser t);
report("prepare d");
for($idx=0; $idx<count($lin es); $idx++) {
report("line $idx started");
$items = explode($token, trim($lines[$idx]));
$stmt->bindParam(":ac ct", $items[0]);
$stmt->bindParam(":re gion", $items[1]);
$stmt->bindParam(":or igin", $items[2]);
$stmt->bindParam(":te rritory", $items[3]);
$stmt->bindParam(":ha lf", $_SESSION["half"]);
$stmt->bindParam(":ye ar", $_SESSION["year"]);
$stmt->bindParam(":us erid",
$_SESSION["employee_numbe r"]);
report("line $idx about to submit");
$stmt->execute();
report("execute d");
}
C.
Nov 4 '08 #7

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

Similar topics

1
1684
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 the database are on the same network, so latency is not an issue. Are there any known performance issues with Oracle and PHP? Is there another API that I can use that might be faster? Thanks!
5
4682
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 know how will the speed be, what is the memory overhead involved, etc during database specific operations (retrieval, update, insert, etc) when MySQL is used with Python.
2
3310
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 seconds the inserts. When we enable oracle's advanced replication the time falls to 44 seconds for the two replicated sites. So the transactions took 7 times more time. It is normal Oracle states that Adv replication takes around 6 times more resource...
2
4846
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 to Oracle with ease. The web-application runs great with Access and SQLServer. But when it comes to Oracle, the performance really lags.
11
6974
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 | varchar(6) | svcrate | varchar(4) | svcclass | char(1) | trailer | varchar(3) |
5
2473
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 configured, I prepared set of data using DBGEN from TPC and I already imported them into databases.Also, I configured the replication. Now I have to do a test with a few kind of replications method implemented in these RDMBS, but I don't know which...
1
1126
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 count of employee by transaction type (hired, fired, retired, left for another job) for the current year. The query is taking more than 45 minutes with no result coming back.
2
2039
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. Reasons could be, 1.The Oracle Server with respect to configuration may have issues. 2.The SQL server optimized queries are not suitable for Oracle(The normal cases, such as datatypes, syntax etc are already taken care). Any help on this is...
0
1282
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 linked server. In my Oracle environment via Sql*Plus I run a simple query (count) which does a join between a 400K table and a 2.5 mil table - this takes about 10 seconds. In my SQL Server environment using the views created via Linked Server, the...
0
1556
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 tables via a linked server. In my Oracle environment via Sql*Plus I run a simple query (count) which does a join between a 400K table and a 2.5 mil table - this takes about 10 seconds. In my SQL Server environment using the views created via...
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.