search

Home  >  Q&A  >  body text

Is there any good way to use PHP to process a very large SQLite file (tens of gigabytes)?

What’s a good way to use PHP to process a very large SQLite file (tens of gigabytes)?
It just died when processing it~~

PHP中文网PHP中文网2780 days ago691

reply all(9)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 13:06:33

    Such a large file cannot be processed by PHP. To process a file, PHP must first read it into memory, and the memory that each script can use is related to the memory_limit in the PHP configuration file. As long as your memory is large enough, you can set it to unlimited and use the maximum memory of the system.

    The recommended solution is to first cut the file into small files, use a shell program such as sed to cut the file into several small files according to a certain size (the size is determined according to your PHP memory size), and then process it with PHP.

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 13:06:33

    Read line by line, PHP has this function, it reads 3 lines at a time, but SQLite is a local database, and reading is a matter of the driver. It has nothing to do with PHP. Just don’t print it all at once

    reply
    0
  • 阿神

    阿神2017-05-16 13:06:33

    The data should be transferred to MYSQL and then provided to PHP for reading and writing. SQLite is originally a small file database with low ability to handle huge data.

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-16 13:06:33

    Shocked! For such a large amount of data, sqlite is still used.
    Besides, if you read dozens of gigabytes into the memory at one time, unless your memory really has dozens of gigabytes, it will definitely burst the memory.
    It is recommended to try to split this database or convert it to other types of database processing.

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 13:06:33

    PHP’s text processing is not ideal and very slow. The solution of processing after entering mysql is feasible, but it is more time-consuming.

    Reference Use it to check

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 13:06:33

    I don’t understand sqlite, but it must be difficult to process such a large file directly. But there is a general idea. Just dismantling. According to the library. Watch or something.

    reply
    0
  • 高洛峰

    高洛峰2017-05-16 13:06:33

    Since it is a sqlite file, just click Database Read->Process->Storage. PHP can use sqlite directly by default.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:06:33

    Convert sqlite to Mysql, then optimize the index, and there should be no problem.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 13:06:33

    Please refer to this product

    reply
    0
  • Cancelreply