Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

dd
Code Block
languagesql
Mach> select * from tag where name = 'TAG_0002' and time between to_date('2018-02-01') and to_date('2018-02-05');
NAME                  TIME                            VALUE                       
--------------------------------------------------------------------------------------
TAG_0002              2018-02-01 01:00:00 000:000:000 11                          
TAG_0002              2018-02-02 02:00:00 000:000:000 12                          
TAG_0002              2018-02-03 03:00:00 000:000:000 13                          
TAG_0002              2018-02-04 04:00:00 000:000:000 14                          
[4] row(s) selected.
Elapsed time: 0.001

Mach> select * from tag where name = 'TAG_0002' and time > to_date('2018-02-01') and time < to_date('2018-02-05');
NAME                  TIME                            VALUE                       
--------------------------------------------------------------------------------------
TAG_0002              2018-02-01 01:00:00 000:000:000 11                          
TAG_0002              2018-02-02 02:00:00 000:000:000 12                          
TAG_0002              2018-02-03 03:00:00 000:000:000 13                          
TAG_0002              2018-02-04 04:00:00 000:000:000 14                          
[4] row(s) selected.
Elapsed time: 0.001
Code Block

다중 태그에 대한 시간 범위 검색

아래는 2개 이상의 태그에 대해서 동일한 시간 범위 데이터를 검색하는 예제이다.

만일 한번의 질의 수행으로 다수의 태그에 대해 한꺼번에 빠른 결과를 받고 싶을 경우에는 아래와 같은 형태의 수행이 바람직하다.

Code Block
Mach> select * from tag where name in ('TAG_0002', 'TAG_0001') and time between to_date('2018-01-05') and to_date('2018-02-05');
NAME                  TIME                            VALUE                       
--------------------------------------------------------------------------------------
TAG_0001              2018-01-05 05:00:00 000:000:000 5                           
TAG_0001              2018-01-06 06:00:00 000:000:000 6                           
TAG_0001              2018-01-07 07:00:00 000:000:000 7                           
TAG_0001              2018-01-08 08:00:00 000:000:000 8                           
TAG_0001              2018-01-09 09:00:00 000:000:000 9                           
TAG_0001              2018-01-10 10:00:00 000:000:000 10                          
TAG_0002              2018-02-01 01:00:00 000:000:000 11                          
TAG_0002              2018-02-02 02:00:00 000:000:000 12                          
TAG_0002              2018-02-03 03:00:00 000:000:000 13                          
TAG_0002              2018-02-04 04:00:00 000:000:000 14                          
[10] row(s) selected.
Elapsed time: 0.001

Rest API를 통한 추출