I need to migrate non-relational database to relational. Non-relational database contains M tables Oi with data. Some of data tables Oi have field (cell) that contains array of primitive elements. Arrays can be of different numeric types and dimensions but all of them can be stored as array of doubles (4-byte int and float can be converted to double reversible). Relational DB will contain these M data tables plus additional tables with schema and one table N that will contain array data for all M tables (but it should has separate row for each array element). In other words, to represent arrays in relational DB I'm going to introduce new table N for array data that can be associated with original cell in table Oi. There will be one table N that will contain array data for all tables O1, O2, ... Oi,...OM. For full picture I mentioned about schema tables but it seems they do not matter.
There are two options:
- First option:
Table Oi (1<= i <= M) (with name APK) and columns:
- PKO (counter of each row - original non-relational table has no PK)
- other columns.
Table N with columns:
- (part of PK of N) APK (name of table Oi)
- (part of PK of N) PKO (foreign key to table O)
- (part of PK of N) index in array
- j-th array value
- Second option:
Table Oi (1<= i <= M) with columns:
- PKN1 (foreign key to table N)
- other columns.
Table N with columns:
- (part of PK of N) PKN1 (counter - unique for each array and equal for all elements in particular array)
- (part of PK of N) index in array
- j-th array value
Notice: APK is a string around 100 chars and first option repeats APK too much. Maybe it's worth to add an alias - integer ID to each string of APK... The semantics of arrays is unknown - the time restriction is very tough. The number and kinds of tables is big. This database is pattern - there will be several dozens of such databases. So the main goal is to accelerate development(One table N is fast and simple solution). Other goal is be able to use SQL to select each array element without imperative programming. This tables store data for testing another data, so QA should easily access data. Which option is better - or are there any suggestions?