Some relational (PostgreSQL for example) databases allow you to store arbitrary array as a field in on row. So your retrieval would be much easier. Also depending on your performance requirements you can store your numbers in CSV format in the single text filed. The search for the group will be much faster. also there is no reordering and sorting during "select" as order is preserved.

It is really hard to give you some idea without knowing more of you problem... but your proposed implementation does carry a lot of overhead - for every number you have two extra fields, not to mention the database internal structures.

My 2c.


Mike McGonagle wrote:
Hello all,
This isn't s question specific to SQLite, so I hope that you don't mind...
but, I am trying to store an ordered lists of numbers of arbitrary length in
a table. I am not really sure what the best method of doing this, but the
way that I have come up with is to create a table with the following:


create table numberlist (

grp integer,
ord integer,
data double

);


where 'grp' is an id to identify the groups of numbers, 'ord' is the
ordering for the list, and 'data' is the numbers themselves.

To get the list back in the order in which they were stored would be:


select data from numberlist where grp = X order by ord;


Is there something that I am missing for a better implementation? These
lists will be ranging anywhere from 2 numbers to 200 or so...


Thanks,

Mike



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to