Re: CSV speed
| From: | Larry Garfield | Date: | Tue, 11 Mar 2008 02:42:38 +0000 |
| Subject: | Re: CSV speed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271246@lists.php.net to get a copy of this message | ||
You may want to consider an SQLite database. Any PHP 5 install is likely to
support it, and it should be very fast for reads. (Not so much for writes,
but if you're dealing with something that can use CSV, it will probably work
in SQLite, too.)
On Monday 10 March 2008, TG wrote:
> If you can't store the values in a real DB, then that might be an option.
> You might consider using a temporary table if it's available in the
> database you're using, that way you don't have to worry about implicitly
> creating then destroying the table.
>
> The only problem is how temporary the temporary table may be. If you can
> do everything you need in one connection, then you should be good.
> Otherwise you'd want to use either a persistant connection or use a real
> table.
>
> You may also load all your CSV data into an array, but that may use up more
> memory and be slower and/or more cumbersome to search.
>
> You could try out a few scenarios and see how they work speed-wise and
> impact on system memory and such.
>
> -TG
>
> ----- Original Message -----
> From: Danny Brow <maillist@fullmotions.com>
> To: PHP <php-general@lists.php.net>
> Date: Mon, 10 Mar 2008 21:09:15 -0400
> Subject: [PHP] CSV speed
>
> > I have about 10 csv files I need to open to access data. It takes a lot
> > of time to search each file for the values I need. Would it be best to
> > just dump all the cvs files to an SQL db and then just grab what I need
> > from there? I'm starting to think it would make a lot of sense. What do
> > you guys think?
> >
> > Thanks,
> > Dan
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson