Le 2012-04-14 17:08, Alex Marin a écrit :
Hi,
I've got an implementation question: Say we have a file with tables to be imported and we have two ways of doing so, each of them having different performance issues:
- Keep an array with all the tables' contents and run PMA_buildSQL()
after all of them have been read. 2. Once a full table has been read, insert it with PMA_buildSQL() in the database.
Option 1. has the advantage of making only one call to the expensive PMA_buildSQL() function. But what happens if we have more than 1000 tables? The array containing all of them will grow pretty big. Option 2. uses far less memory in this case, but, on the other hand, it makes 1000 calls to the previous function.
What would make a good argument in choosing one of those approaches?
Alex, if you _have_ to choose one of the approaches, you have to choose the one that works for a great number of tables (or one really big table), therefore #2. Otherwise, you should tell the limitations of the approach to the user.
If you _don't have_ to choose (if coding both approaches is easy), you can code both and call the best one, depending on the number of tables.
P.S. maybe PMA_buildSQL() itself needs improvement.