Re: [nyphp-talk] slow php

2009-02-16 Thread Hans Zaunere
> One note, please add at least the subject of the thread in when replying to a > section of a digest email and puleaze trim messages. 90% of your email had > nothing to do with what you were asking. I won't even get into the top posting > issue Thanks David, this is something I've been meanin

Re: [nyphp-talk] slow php

2009-02-16 Thread David Krings
Nicholas Hart wrote: Many thanks for the considerable response! I have changed the code to reduce a large number of SELECTs by saving a query to an array. My problem now is that although this array is appox. 3,000 records, I need a way to pass this to a function. Note: the array contains all

Re: [nyphp-talk] slow php

2009-02-16 Thread Tim Lieberman
y footprint as small as possible. PHP's garbage collection cannot always be, well, perfect, for long running processes. H -- Message: 2 Date: Fri, 13 Feb 2009 16:16:50 -0500 From: Rolan Yang Subject: Re: [nyphp-talk] slow php To: NYPHP Talk Message-ID:

Re: [nyphp-talk] slow php

2009-02-16 Thread David Krings
Anirudh Zala wrote: > Besides all of these good suggestions, always use "timers" to measure time spent behind execution of certain portion of your script to identify what part is taking so long. Or usa an IDE that includes a profiler, because those are designed for that purpose (at least dur

Re: [nyphp-talk] slow php

2009-02-15 Thread Anirudh Zala
On Saturday 14 Feb 2009 2:01:58 am Nicholas Hart wrote: > I have a php 'cron job' script which is inserting some records. It uses > arrays to store 12 field records along with several nested loops in which > it tests various currency values from a separate 4 field table and sorts > them to get the

Re: [nyphp-talk] slow php

2009-02-13 Thread Daniel Convissor
Hi Nicholas: Here are two additional options to consider, both revolving around the concept of getting the database to do the work. First, many people write scripts to read, modify and then write the data back to the database because they are unfamilliar with the INSERT SELECT and UPDATE SELEC

Re: [nyphp-talk] slow php (slow database)

2009-02-13 Thread Paul A Houle
The fastest way to get data into mysql is like this: http://dev.mysql.com/doc/refman/5.1/en/load-data.html I needed to load 2.5M RDF triples into mysql to look up some identifiers. My RDF store balked at the turtle file, so I hacked away the header and treated it like a space-separated file.

Re: [nyphp-talk] slow php (slow database)

2009-02-13 Thread Hans Zaunere
> > Also, it may be that mySQL supports multiple inserts per line, in which case > > you can do 10 inserts per round trip. This will speed it up w/o requiring > > you to do to a different command for the bulk copy. > > To the best of my knowledge, you can't send more than one statement at > a tim

Re: [nyphp-talk] slow php (slow database)

2009-02-13 Thread csnyder
On Fri, Feb 13, 2009 at 3:39 PM, Kenneth Downs wrote: > This ain't PHP,and Python won't help. Inserting 2.4 million rows into a > database will take hours if you go line by line. You are paying a big > overhead of a round trip to the server for each row. > > The best way to speed it up is to use

Re: [nyphp-talk] slow php

2009-02-13 Thread Rolan Yang
Nicholas Hart wrote: I have a php 'cron job' script which is inserting some records. It uses arrays to store 12 field records along with several nested loops in which it tests various currency values from a separate 4 field table and sorts them to get the lowest one for insert into a new 4 fi

Re: [nyphp-talk] slow php

2009-02-13 Thread Hans Zaunere
> I have a php 'cron job' script which is inserting some records. It > uses arrays to store 12 field records along with several nested loops > in which it tests various currency values from a separate 4 field table > and sorts them to get the lowest one for insert into a new 4 field > table record

Re: [nyphp-talk] slow php

2009-02-13 Thread Anthony Wlodarski
t; Web Applications Developer 568 Broadway Ste. 605 New York, NY, 10012 (o) 646.786.1944 From: Jesse Callaway Reply-To: NYPHP Talk Date: Fri, 13 Feb 2009 12:37:06 -0800 To: NYPHP Talk Subject: Re: [nyphp-talk] slow php On Fri, Feb 13, 2009 at 3:31 PM, Nichola

Re: [nyphp-talk] slow php (slow database)

2009-02-13 Thread Kenneth Downs
This ain't PHP,and Python won't help. Inserting 2.4 million rows into a database will take hours if you go line by line. You are paying a big overhead of a round trip to the server for each row. The best way to speed it up is to use what they call "bulk copy" on MS SQL Server and "copy" on P

Re: [nyphp-talk] slow php

2009-02-13 Thread Jesse Callaway
On Fri, Feb 13, 2009 at 3:31 PM, Nicholas Hart wrote: > I have a php 'cron job' script which is inserting some records. It uses > arrays to store 12 field records along with several nested loops in which it > tests various currency values from a separate 4 field table and sorts them > to get the

[nyphp-talk] slow php

2009-02-13 Thread Nicholas Hart
I have a php 'cron job' script which is inserting some records. It uses arrays to store 12 field records along with several nested loops in which it tests various currency values from a separate 4 field table and sorts them to get the lowest one for insert into a new 4 field table record. It has