Support the ongoing development of Laravel.io →
Database
Last updated 2 years ago.
0

depends.. there might be timeout limits.. so you would have to do it in batches..

alternatively you could write to a file creating a csv or SQL or something and use phpmysql or command line to insert that?

0

awsp said:

Please use mysqlimport ...

https://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html

mysqliimport does not exist in PHP. I said i generated them ;)

shez1983 said:

depends.. there might be timeout limits.. so you would have to do it in batches..

alternatively you could write to a file creating a csv or SQL or something and use phpmysql or command line to insert that?

Probably.. Or make something like chunk() used in laravel and replicate to php ?

0

Like @shez1983 said, write to a csv file then use tools like mysqlimport or mongoimport (the command line) seems to be fastest way.

It doesn't make too much sense to bulk insert that kind of big data straightly using PHP as it is single threaded and I/O blocking. (I assume you generate data on-the fly. ) I wouldn't say you cannot absolutely do it in PHP, but the bottleneck seems to be code performance and I/O blocking nature that would likely timeout your application.

For multithreading There is a project called pthread that allows PHP to do multithreading. http://stackoverflow.com/questions/70855/how-can-one-use-multi-threading-in-php-applications

For non I/O blocking You might wanna try ReactPHP to allow you to do non-blocking coding. If you could also find out database driver that supports non-blocking database access, that would be even better.

Anyway, good luck with PHP.

sciasfreelancer said:

awsp said:

Please use mysqlimport ...

https://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html

mysqliimport does not exist in PHP. I said i generated them ;)

shez1983 said:

depends.. there might be timeout limits.. so you would have to do it in batches..

alternatively you could write to a file creating a csv or SQL or something and use phpmysql or command line to insert that?

Probably.. Or make something like chunk() used in laravel and replicate to php ?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.