I am using the Zeoslib library in Delphi.
I have a large multidimensional static array that I need to transfer to an empty table in a local MySQL database. How can I do this efficiently?
Just iterate through a million insert statements?
I am using the Zeoslib library in Delphi.
I have a large multidimensional static array that I need to transfer to an empty table in a local MySQL database. How can I do this efficiently?
Just iterate through a million insert statements?
INSERT INTO tab VALUES (v11,..., v1n), ..., (vm1, ..., vmn)
. IOW, you can collect your array rows into chunks consisting of M rows. This will seriously improve performance. (More)LOAD DATA INFILE
statement to load text file efficiently. (More)Multi-dimensional array's don't translate well to MySQL.
If you're dealing with a tiny array you'll probably get things done, but it just doesn't scale. No matter what, it's going to get ugly real soon.
http://dev.mysql.com/doc/refman/4.1/en/column-count-limit.html
There is a hard limit of 4096 columns per table, but the effective maximum may be less for a given table. The exact limit depends on several interacting factors, listed in the following discussion.
Every table has a maximum row size of 65,535 bytes. This maximum applies to all storage engines, but a given engine might have additional constraints that result in a lower effective maximum row size.
http://dev.mysql.com/doc/refman/5.0/en/joins-limits.html
The maximum number of tables that can be referenced in a single join is 61. This also applies to the number of tables that can be referenced in the definition of a view.
sum(if(x=1,y,0))
I had the same problem, only in php 2D arrays. Save the dimensions of the array (x, y, z etc. length, meaning the number of values on each level). then join the whole array into ane long string, divide with a special, unique character like |
or ,
, and when you fetch the data you can split the sting based on the dimensions data.
If you need it, I can show you my php code, but I see you prefer delphi.
EDIT: this is an answer for your question before you edited it. Now it's kind of irrelevant.