I
I
igamity2011-07-03 21:49:17
Database
igamity, 2011-07-03 21:49:17

Help me choose a database

Good afternoon!

Need advice on choosing a storage system. Output data: a potentially unlimited array of numeric data, for example:

ID VALUE
1 10.01
2 11.13
3 9.78
4 10.00
5 9.99
6 12.45
... ...

It is required to select a storage that would allow selecting data according to the conditions of their mutual relations, for example, to select the values ​​of X i , which are local maxims:
where X i+1 < X i > X i-1 .

Such a condition is the simplest, more complex ones are possible, but they have one thing in common: it is required to compare the current value with any other, in order of increasing index (or decreasing). That is, for example, there is some value X i , it is required to find the value of Y j closest by index value , such that Y j > X i , and j > i .

Answer the question

In order to leave comments, you need to log in

8 answer(s)
S
Shedal, 2011-07-03
@Shedal

SELECT *
FROM myTable t1
JOIN myTable t2
    ON t1.Id < t2.Id
    AND t1.Value > t2.Value
WHERE t2.Id = 100
ORDER BY t1.Id DESC
LIMIT 1;

This is so, by the way :)
If you need to make such a selection for all Ids, then you can make a subquery, or GROUP BY.

P
pomme, 2011-07-04
@pomme

It looks like stock quotes :) It's
hard to advise blindly without knowing the type of your requests, but your structure is called "time series" (time series). There is a list of software for working with them, for example, here: ces.stat.ucla.edu/software/time-series-analysis . You, I think, will not only have to search for them, but also transform - scale, apply filters, remove noise, etc.

S
simplecode, 2011-07-03
@simplecode

I think that it doesn’t matter ... competent ability to compose SQL queries drives ...

A
Anatoly, 2011-07-03
@taliban

For such simple tables, you can also take a look at nosql solutions. Perhaps they will show themselves better under such data and conditions.

V
VBart, 2011-07-03
@VBart

For such a formalized task, if you need maximum speeds, you can also make your own bicycle using the same C, for example, since the task is very simple.

P
Puma Thailand, 2011-07-04
@opium

For such tasks, it would be much more correct to store data in memory and dump them, say, on disk from time to time so as not to lose them. I don’t see any special applications for sql or nosql solutions.

F
Fedor Indutny, 2011-07-04
@donnerjack13589

Riak and compute everything with distributed MapReduce

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question