There is a 300MB table in the database, when exporting this table to the php array format, it turns out a file with an array of the same size. Working with him through php is not an option.

If I make an ordinary sql query with the selection of all fields of this table, and get them as an array through mysql_fetch_ array, in the end I will get an array with the 2nd values ​​for each field, as key => value.

The first key is the name of the table field, and the second is just a numeric value.

And when exporting a table, there is only one value for each field.

Why is it easier to work with an array that returns mysql_fetch_array and do not generate errors that lack memory, etc.?

  • "Working with him through php is not an option" - a controversial statement. If you load the entire file into memory, then you are obviously doing something wrong. Organize stream processing. Load one line at a time and export to a file not in the form of a PHP array (by the way how exactly did you do this?) But, for example, in XML or CSV - tutankhamun

1 answer 1

Because mysql_fetch_array selects just one line from the server response at a time into the array, and does not load all 300 meters into the array.

- IO KO