Home > database >  Select the top problem
Select the top problem

Time:10-01

Monitoring project, 16 sensors, sampling frequency 50 hz, built a table stores the data, structure is simple: time + numerical

 Create Table real_data (
Record_time timestamp (3),
Ac_1 Float,
Ac_2 Float,
Ac_3 Float,
Ac_4 Float,
Ac_5 Float,
Ac_6 Float,
Ac_7 Float,
Ac_8 Float,
Ac_9 Float,
Ac_10 Float,
Ac_11 Float,
Ac_12 Float,
Ac_13 Float,
Ac_14 Float,
Ac_15 Float,
Ac_16 Float
)
In Tablespace data_test;


Every 10 minutes to have a job from the table data will be moved to the other table,

Now there is a business logic client every 20 or 40 ms ms in this article the latest data,
Statement is:
 select RECORD_TIME, ac_6 from (select RECORD_TIME, ac_6 from ac_real_data order by RECORD_TIME desc) where rownum<=1 order by record_time desc 


Now come out as a result, every 3 to 4 times of the query data is the same, then the time suddenly jump, but the situation is this table 20 ms have to insert data, basic no delay,

 2017-02-23 15:38:53, 569 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23 
The 2017-02-23 15:38:53, 600 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 661 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 693 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 723 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 756 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 786 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 816 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 847 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 887 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 924 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 958 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:53, 994 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:54, 039 [8] the DEBUG testchart. Window1: time is the 320 15:35:20 2017-02-23
The 2017-02-23 15:38:54, 390 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 466 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 507 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 550 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 584 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 635 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 675 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 707 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23
The 2017-02-23 15:38:54, 755 [8] the DEBUG testchart. Window1: time is the 320 15:35:23 2017-02-23


This is how to return a responsibility? Thank you very much!

CodePudding user response:

But the situation is this table 20 ms have to insert data, basic no delay,


Have data deleted? If the first data deleted, this query, you will also be the result of the change;

CodePudding user response:

If not, just use the row_number () over ()

CodePudding user response:

reference 1st floor wmxcn2000 response:
but the situation is this table 20 ms have to insert data, basic no delay,


Have data deleted? If the first data deleted, this query, you will also be the result of the change;



10 minutes have data transfer, I will put the table in the current time of 2 minutes before the data is transferred to another table, and delete,

I don't have any operation in 10 minutes, in this way the query, or so

CodePudding user response:

refer to the second floor POM_24 response:
if not, use the row_number () over ()


Thank you very much!

Can you specifically,
  • Related