Is this data suitable for storage in a database?

Regarding my previous question, where I asked for some database suggestions; it just seemed to me that I didn’t even know if what I was trying to save was suitable for the database. Or some other data storage method should be used.

I have testing physical models (say, wind tunnel data, something similar), where for each model (M-1234) I have:

name (M-1234) length L breadth B height HL/B ratio L/H ratio ... lot of other ratios and dimensions ... force versus speed curve given in the form of a lot of points for xy plotting ... few other similar curves (all of them of type xy). 

Now, what I'm trying to accomplish is reasonable, so the user who will use the database can come and see which are the closest ten models for L / B = 2.5 (or some similar demand). Then, for this, somehow get all the data of these models, including the curve data (in the format of a plain text file).

Is an sql database (or any other, for that matter) an appropriate way to handle something like this? Or should I use a different approach?

I have about a month to finish this, and at that time I should also be good enough about databases, so ... give your suggestions, please, considering this. Do not assume any prior knowledge on this subject.

+4
source share
3 answers

I think what you are looking for is possible. I use Postgresql here, but any database should work. This is my test database.

 CREATE TABLE test ( id serial primary key, ratio double precision ); COPY test (id, ratio) FROM stdin; 1 0.29999999999999999 2 0.40000000000000002 3 0.59999999999999998 4 0.69999999999999996 . 

Then, to find the nearest values ​​in a certain ratio

select id,ratio,abs(ratio-0.5) as score from test order by score asc limit 2;

In this case, I am looking for the closest to 0.5

I would probably do a datamodel where you have one table for the main data, coefficients, etc., and then a second table that contains the points of the curve, since I assume that the curves are not always the same size.

+2
source

Yes, a database is best suited for this.

A relational database (which typically uses SQL to access data) is suitable for data that is more or less structured in tabular form.

To give you an idea:

You may have a main model table with fields name , width , etc. Then a subtable for any values ​​that may appear more than once that return to model (find the "foreign key").

Then the subtable for your real curves, again referring to model .

I don’t know how to actually model curves in the database, because I don’t know how you model them. But if its number of numbers, it can enter the database.

It seems you know little about relational DBMSs. Consider reading something on WIkipedia or making some simple DBMS manuals (PostgreSQL has some: http://www.postgresql.org/docs/8.4/interactive/tutorial.html , but there are many others). Then select the DBMS for testing (PostgreSQL is probably not a bad choice, but again there are many others).

Then try to implement a simple table layout and come back to us with any detailed questions (which you are likely to have).

One more thing: these questions are probably more suitable for serverfault.com.

+2
source

This is possibly scientific data: you can find libraries / formats designed to use any scientific data: HDF5 http://www.hdfgroup.org/ (note I'm not an expert)

0
source

Source: https://habr.com/ru/post/1301991/


All Articles