六月婷婷AV,国产偷窥猎奇福利二区,日韩三级片。,好吊色网站,日韩成人中文在线视频,国产亚洲午夜啪啪,亚洲欧美另类国产精品,国产成人av1,任你艹在线观看

如何使用 taosBenchmark 進(jìn)行性能測試

自從 TDengine 2019年 7 月開源以來,憑借創(chuàng)新的數(shù)據(jù)建模設(shè)計、快捷的安裝方式、易用的編程接口和強(qiáng)大的數(shù)據(jù)寫入查詢性能博得了大量時序數(shù)據(jù)開發(fā)者的青睞。其中寫入和查詢性能往往令剛接觸 TDengine 的用戶稱嘆不已。為了便于用戶在最短時間內(nèi)就可以體驗到 TDengine 的高性能特點,我們專門開發(fā)了一個應(yīng)用程序 taosBenchmark (曾命名為 taosdemo)用于對 TDengine 進(jìn)行寫入和查詢的性能測試,用戶可以通過 taosBenchmark 輕松模擬大量設(shè)備產(chǎn)生海量數(shù)據(jù)的場景,并且可以通過 taosBenchmark 參數(shù)靈活按照實際場景定制表的個數(shù)(對應(yīng)設(shè)備數(shù))、表的列數(shù)(對應(yīng)每個設(shè)備采樣點)、數(shù)據(jù)類型、亂序數(shù)據(jù)比例、順序或輪詢插入方式、以及并發(fā)線程數(shù)量。

運行 taosBenchmark 很簡單,通過下載 TDengine 安裝包或者自行下載 TDengine 代碼編譯都可以在安裝目錄或者編譯結(jié)果目錄中找到并運行。

接下來本文為大家講解 taosBenchmark 的使用介紹及注意事項。

使用 taosBenchmark 進(jìn)行寫入測試

不使用任何參數(shù)的情況下執(zhí)行 taosBenchmark 命令,輸出如下:

$ taosBenchmark

taosBenchmark is simulating data generated by power equipment monitoring...

host:                       127.0.0.1:6030
user:                       root
password:                   taosdata
configDir:
resultFile:                 ./output.txt
thread num of insert data:  8
thread num of create table: 8
top insert interval:        0
number of records per req:  30000
max sql length:             1048576
database count:             1
database[0]:
  database[0] name:      test
  drop:                  yes
  replica:               1
  precision:             ms
  super table count:     1
  super table[0]:
      stbName:           meters
      autoCreateTable:   no
      childTblExists:    no
      childTblCount:     10000
      childTblPrefix:    d
      dataSource:        rand
      iface:             taosc
      insertRows:        10000
      interlaceRows:     0
      disorderRange:     1000
      disorderRatio:     0
      maxSqlLen:         1048576
      timeStampStep:     1
      startTimestamp:    2017-07-14 10:40:00.000
      sampleFormat:
      sampleFile:
      tagsFile:
      columnCount:       3
column[0]:FLOAT column[1]:INT column[2]:FLOAT
      tagCount:            2
        tag[0]:INT tag[1]:BINARY(16)

         Press enter key to continue or Ctrl-C to stop

這里顯示的是接下來 taosBenchmark 進(jìn)行數(shù)據(jù)寫入的各項參數(shù)。默認(rèn)不輸入任何命令行參數(shù)的情況下 taosBenchmark 將模擬生成一個電力行業(yè)典型應(yīng)用的電表數(shù)據(jù)采集場景數(shù)據(jù)。即建立一個名為 test 的數(shù)據(jù)庫,并創(chuàng)建一個名為 meters 的超級表,其中表結(jié)構(gòu)為:

taos> describe test.meters;
             Field              |         Type         |   Length    |   Note   |
=================================================================================
 ts                             | TIMESTAMP            |           8 |          |
 current                        | FLOAT                |           4 |          |
 voltage                        | INT                  |           4 |          |
 phase                          | FLOAT                |           4 |          |
 groupid                        | INT                  |           4 | TAG      |
 location                       | BINARY               |          64 | TAG      |
Query OK, 6 row(s) in set (0.002972s)

按任意鍵后 taosBenchmark 將建立數(shù)據(jù)庫 test 和超級表 meters,并按照 TDengine 數(shù)據(jù)建模的最佳實踐,以 meters 超級表為模板生成一萬個子表,代表一萬個獨立上報數(shù)據(jù)的電表設(shè)備。

taos> use test;
Database changed.

taos> show stables;
              name              |      created_time       | columns |  tags  |   tables    |
============================================================================================
 meters                         | 2021-08-27 11:21:01.209 |       4 |      2 |       10000 |
Query OK, 1 row(s) in set (0.001740s)

然后 taosBenchmark 為每個電表設(shè)備模擬生成一萬條記錄:

...
====thread[3] completed total inserted rows: 6250000, total affected rows: 6250000. 347626.22 records/second====
[1]:100%
====thread[1] completed total inserted rows: 6250000, total affected rows: 6250000. 347481.98 records/second====
[4]:100%
====thread[4] completed total inserted rows: 6250000, total affected rows: 6250000. 347149.44 records/second====
[8]:100%
====thread[8] completed total inserted rows: 6250000, total affected rows: 6250000. 347082.43 records/second====
[6]:99%
[6]:100%
====thread[6] completed total inserted rows: 6250000, total affected rows: 6250000. 345586.35 records/second====
Spent 18.0863 seconds to insert rows: 100000000, affected rows: 100000000 with 16 thread(s) into test.meters. 5529049.90 records/second

insert delay, avg:      28.64ms, max:     112.92ms, min:       9.35ms

以上信息是在一臺具備 8個CPU 64G 內(nèi)存的普通 PC 服務(wù)器上進(jìn)行實測的結(jié)果。顯示 taosBenchmark 用了 18 秒的時間插入了 100000000 (一億)條記錄,平均每秒鐘插入 552 萬 9千零49 條記錄。

TDengine 還提供性能更好的參數(shù)綁定接口,而在同樣的硬件上使用參數(shù)綁定接口 (taosBenchmark -I stmt )進(jìn)行相同數(shù)據(jù)量的寫入,結(jié)果如下:

...

====thread[14] completed total inserted rows: 6250000, total affected rows: 6250000. 1097331.55 records/second====
[9]:97%
[4]:97%
[3]:97%
[3]:98%
[4]:98%
[9]:98%
[3]:99%
[4]:99%
[3]:100%
====thread[3] completed total inserted rows: 6250000, total affected rows: 6250000. 1089038.19 records/second====
[9]:99%
[4]:100%
====thread[4] completed total inserted rows: 6250000, total affected rows: 6250000. 1087123.09 records/second====
[9]:100%
====thread[9] completed total inserted rows: 6250000, total affected rows: 6250000. 1085689.38 records/second====
[11]:91%
[11]:92%
[11]:93%
[11]:94%
[11]:95%
[11]:96%
[11]:97%
[11]:98%
[11]:99%
[11]:100%
====thread[11] completed total inserted rows: 6250000, total affected rows: 6250000. 1039087.65 records/second====
Spent 6.0257 seconds to insert rows: 100000000, affected rows: 100000000 with 16 thread(s) into test.meters. 16595590.52 records/second

insert delay, avg:       8.31ms, max:     860.12ms, min:       2.00ms

顯示 taosBenchmark 用了 6 秒的時間插入了一億條記錄,每秒鐘插入性能高達(dá) 1659 萬 5 千 590 條記錄。

由于 taosBenchmark 使用起來非常方便,我們又對 taosBenchmark 做了更多的功能擴(kuò)充,使其支持更復(fù)雜的參數(shù)設(shè)置,便于進(jìn)行快速原型開發(fā)的樣例數(shù)據(jù)準(zhǔn)備和驗證工作。

完整的 taosBenchmark 命令行參數(shù)列表可以通過 taosBenchmark --help 顯示如下:

$ taosBenchmark --help

Usage: taosBenchmark [OPTION...]

  -f, --file=FILE            (**IMPORTANT**) Set JSON configuration file(all
                             options are going to read from this JSON file),
                             which is mutually exclusive with other commandline
                             options
  -a, --replia=NUMBER        The number of replica when create database,
                             default is 1.
  -A, --tag-type=TAG_TYPE    Data type of tables' tags, default is
                             INT,BINARY(16).
  -b, --data-type=COL_TYPE   Data type of tables' cols, default is
                             FLOAT,INT,FLOAT.
  -B, --interlace-rows=NUMBER   The number of interlace rows insert into
                             tables, default is 0
  -c, --config-dir=CONFIG_DIR   Configuration directory.
  -C, --chinese              Nchar and binary are basic unicode chinese
                             characters, optional.
  -d, --database=DATABASE    Name of database, default is test.
  -E, --escape-character     Use escape character in stable and child table
                             name, optional.
  -F, --prepared_rand=NUMBER Random data source size, default is 10000.
  -g, --debug                Debug mode, optional.
  -G, --performance           Performance mode, optional.
  -h, --host=HOST            TDengine server FQDN to connect, default is
                             localhost.
  -i, --insert-interval=NUMBER   Insert interval for interlace mode in
                             milliseconds, default is 0.
  -I, --interface=IFACE      insert mode, default is taosc, options:
                             taosc|rest|stmt|sml
  -l, --columns=NUMBER       Number of INT data type columns in table, default
                             is 0.
  -m, --table-prefix=TABLE_PREFIX
                             Prefix of child table name, default is d.
  -M, --random               Data source is randomly generated, optional.
  -n, --records=NUMBER       Number of records for each table, default is
                             10000.
  -N, --normal-table         Only create normal table without super table,
                             optional.
  -o, --output=FILE          The path of result output file, default is
                             ./output.txt.
  -O, --disorder=NUMBER      Ratio of inserting data with disorder timestamp,
                             default is 0.
  -p, --password=PASSWORD    The password to use when connecting to the server,
                             default is taosdata.
  -P, --port=PORT            The TCP/IP port number to use for the connection,
                             default is 6030.
  -r, --rec-per-req=NUMBER   Number of records in each insert request, default
                             is 30000.
  -R, --disorder-range=NUMBER   Range of disordered timestamp, default is 1000.

  -S, --time-step=NUMBER     Timestamp step in milliseconds, default is 1.
  -t, --tables=NUMBER        Number of child tables, default is 10000.
  -T, --threads=NUMBER       The number of thread when insert data, default is
                             8.
  -u, --user=USER            The user name to use when connecting to the
                             server, default is root.
  -w, --binwidth=NUMBER      The default length of nchar and binary if not
                             specified, default is 64.
  -x, --aggr-func            Query aggregation function after insertion,
                             optional.
  -y, --answer-yes           Pass confirmation prompt to continue, optional.
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <support@taosdata.com>.

taosBenchmark 的參數(shù)是為了滿足數(shù)據(jù)模擬的需求來設(shè)計的。下面介紹幾個常用的參數(shù):

-I, --interface=IFACE     The interface (taosc, rest, and stmt) taosBenchmark uses. Default is 'taosc'.

前面介紹 taosBenchmark 不同接口的性能差異已經(jīng)提到, -I 參數(shù)為選擇不同的接口,目前支持 taosc、stmt 和 rest 幾種。其中 taosc 為使用 SQL 語句方式進(jìn)行數(shù)據(jù)寫入;stmt 為使用參數(shù)綁定接口進(jìn)行數(shù)據(jù)寫入;rest 為使用 RESTful 協(xié)議進(jìn)行數(shù)據(jù)寫入。

-T, --threads=NUMBER          The number of threads. Default is 8.

-T 參數(shù)設(shè)置 taosBenchmark 使用多少個線程進(jìn)行數(shù)據(jù)同步寫入,通過多線程可以盡最大可能壓榨硬件的處理能力。

-b, --data-type=DATATYPE      The data_type of columns, default: FLOAT, INT, FLOAT.

-w, --binwidth=WIDTH          The width of data_type 'BINARY' or 'NCHAR'. Default is 64

-l, --columns=COLUMNS         The number of columns per record. Demo mode by default is 3 (float, int, float). Max values is 4095

前文提到,taosBenchmark 默認(rèn)創(chuàng)建一個典型電表數(shù)據(jù)采集應(yīng)用場景,每個設(shè)備包含電流電壓相位3個采集量。對于需要定義不同的采集量,可以使用 -b 參數(shù)。TDengine 支持 BOOL、TINYINT、SMALLINT、INT、BIGINT、FLOAT、DOUBLE、BINARY、NCHAR、TIMESTAMP 等多種數(shù)據(jù)類型。通過 -b 加上以“ , ”(英文逗號)分割定制類型的列表可以使 taosBenchmark 建立對應(yīng)的超級表和子表并插入相應(yīng)模擬數(shù)據(jù)。通過 -w 參數(shù)可以指定 BINARY 和 NCHAR 數(shù)據(jù)類型的列的寬度(默認(rèn)為 64 )。-l 參數(shù)可以在 -b 參數(shù)指定數(shù)據(jù)類型的幾列之后補(bǔ)充以 INT 型的總的列數(shù),特別多列的情況下可以減少手工輸入的過程,最多支持到 4095 列。

-r, --rec-per-req=NUMBER      The number of records per request. Default is 30000.

為了達(dá)到 TDengine 性能極限,可以使用多客戶端、多線程以及一次插入多條數(shù)據(jù)來進(jìn)行數(shù)據(jù)寫入。 -r 參數(shù)為設(shè)置一次寫入請求可以拼接的記錄條數(shù),默認(rèn)為30000條。有效的拼接記錄條數(shù)還和客戶端緩沖區(qū)大小有關(guān),目前的緩沖區(qū)為 1M Bytes,如果記錄的列寬度比較大,最大拼接記錄條數(shù)可以通過 1M 除以列寬(以字節(jié)為單位)計算得出。

-t, --tables=NUMBER           The number of tables. Default is 10000.
-n, --records=NUMBER          The number of records per table. Default is 10000.
-M, --random                  The value of records generated are totally random. The default is to simulate power equipment scenario.

前面提到 taosBenchmark 默認(rèn)創(chuàng)建 10000 個表,每個表寫入 10000 條記錄??梢酝ㄟ^ -t 和 -n 設(shè)置表的數(shù)量和每個表的記錄的數(shù)量。默認(rèn)無參數(shù)生成的數(shù)據(jù)為模擬真實場景,模擬生成的數(shù)據(jù)為電流電壓相位值增加一定的抖動,可以更真實表現(xiàn) TDengine 高效的數(shù)據(jù)壓縮能力。如果需要模擬生成完全隨機(jī)數(shù)據(jù),可以通過 -M 參數(shù)。

-y, --answer-yes              Default input yes for prompt.

前面我們可以看到 taosBenchmark 默認(rèn)在進(jìn)行創(chuàng)建數(shù)據(jù)庫或插入數(shù)據(jù)之前輸出將要進(jìn)行操作的參數(shù)列表,方便使用者在插入之前了解即將進(jìn)行的數(shù)據(jù)寫入的內(nèi)容。為了方便進(jìn)行自動測試,-y 參數(shù)可以使 taosBenchmark 輸出參數(shù)后立刻進(jìn)行數(shù)據(jù)寫入操作。

-O, --disorder=NUMBER         Insert order mode--0: In order, 1 ~ 50: disorder ratio. Default is in order.
-R, --disorder-range=NUMBER   Out of order data's range, ms, default is 1000.

在某些場景,接收到的數(shù)據(jù)并不是完全按時間順序到來,而是包含一定比例的亂序數(shù)據(jù),TDengine 也能進(jìn)行很好的處理。為了模擬亂序數(shù)據(jù)的寫入,taosBenchmark 提供 -O 和 -R 參數(shù)進(jìn)行設(shè)置。-O 參數(shù)為 0 和不使用 -O 參數(shù)相同為完全有序數(shù)據(jù)寫入。1 到 50 為數(shù)據(jù)中包含亂序數(shù)據(jù)的比例。-R 參數(shù)為亂序數(shù)據(jù)時間戳偏移的范圍,默認(rèn)為 1000 毫秒。另外注意,時序數(shù)據(jù)以時間戳為唯一標(biāo)識,所以亂序數(shù)據(jù)可能會生成和之前已經(jīng)寫入數(shù)據(jù)完全相同的時間戳,這樣的數(shù)據(jù)會根據(jù)數(shù)據(jù)庫創(chuàng)建的 update 值或者被丟棄(update 0)或者覆蓋已有數(shù)據(jù)(update 1 或 2),而總的數(shù)據(jù)條數(shù)可能和期待的條數(shù)不一致的情況。

 -g, --debug                   Print debug info.

如果對 taosBenchmark 寫入數(shù)據(jù)過程感興趣或者數(shù)據(jù)寫入結(jié)果不符合預(yù)期,可以使用 -g 參數(shù)使 taosBenchmark 打印執(zhí)行過程中間調(diào)試信息到屏幕上,或通過 Linux 重定向命令導(dǎo)入到另外一個文件,方便找到發(fā)生問題的原因。另外 taosBenchmark 在執(zhí)行失敗后也會把相應(yīng)執(zhí)行的語句和調(diào)試原因輸出到屏幕??梢运阉?reason 來找到 TDengine 服務(wù)端返回的錯誤原因信息。

-x, --aggr-func               Test aggregation functions after insertion.

TDengine 不僅僅是插入性能非常強(qiáng)大,由于其先進(jìn)的數(shù)據(jù)庫引擎設(shè)計使查詢性能也異常強(qiáng)大。taosBenchmark 提供一個 -x 函數(shù),可以在插入數(shù)據(jù)結(jié)束后進(jìn)行常用查詢操作并輸出查詢消耗時間。以下為在前述服務(wù)器上進(jìn)行插入一億條記錄后進(jìn)行常用查詢的結(jié)果。

可以看到 select * 取出一億條記錄(不輸出到屏幕)操作僅消耗1.26秒。而對一億條記錄進(jìn)行常用的聚合函數(shù)操作通常僅需要二十幾毫秒,時間最長的 count 函數(shù)也不到四十毫秒。

taosBenchmark -I stmt -T 48 -y -x
...
...
select          * took 1.266835 second(s)
...
select   count(*) took 0.039684 second(s)
...
Where condition: groupid = 1
select avg(current) took 0.025897 second(s)
...
select sum(current) took 0.025622 second(s)
...
select max(current) took 0.026124 second(s)
...
...
select min(current) took 0.025812 second(s)
...
select first(current) took 0.024105 second(s)
...

除了命令行方式, taosBenchmark 還支持接受指定一個 JSON 文件做為傳入?yún)?shù)的方式來提供更豐富的設(shè)置。一個典型的 JSON 文件內(nèi)容如下:

{
    "filetype": "insert",
    "cfgdir": "/etc/taos",
    "host": "127.0.0.1",
    "port": 6030,
    "user": "root",
    "password": "taosdata",
    "thread_count": 4,
    "thread_count_create_tbl": 4,
    "result_file": "./insert_res.txt",
    "confirm_parameter_prompt": "no",
    "insert_interval": 0,
    "interlace_rows": 100,
    "num_of_records_per_req": 100,
    "databases": [{
        "dbinfo": {
            "name": "db",
            "drop": "yes",
            "replica": 1,
            "days": 10,
            "cache": 16,
            "blocks": 8,
            "precision": "ms",
            "keep": 3650,
            "minRows": 100,
            "maxRows": 4096,
            "comp":2,
            "walLevel":1,
            "cachelast":0,
            "quorum":1,
            "fsync":3000,
            "update": 0
        },
        "super_tables": [{
            "name": "stb",
            "child_table_exists":"no",
            "childtable_count": 100,
            "childtable_prefix": "stb_",
            "auto_create_table": "no",
            "batch_create_tbl_num": 5,
            "data_source": "rand",
            "insert_mode": "taosc",
            "insert_rows": 100000,
            "childtable_limit": 10,
            "childtable_offset":100,
            "interlace_rows": 0,
            "insert_interval":0,
            "max_sql_len": 1024000,
            "disorder_ratio": 0,
            "disorder_range": 1000,
            "timestamp_step": 10,
            "start_timestamp": "2020-10-01 00:00:00.000",
            "sample_format": "csv",
            "sample_file": "./sample.csv",
            "use_sample_ts": "no",
            "tags_file": "",
            "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}],
            "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
        }]
    }]
}

例如:我們可以通過 "thread_count" 和 "thread_count_create_tbl" 來為建表和插入數(shù)據(jù)指定不同數(shù)量的線程??梢酝ㄟ^ "child_table_exists"、"childtable_limit" 和 "childtable_offset" 的組合來使用多個 taosBenchmark 進(jìn)程(甚至可以在不同的電腦上)對同一個超級表的不同范圍子表進(jìn)行同時寫入。也可以通過 "data_source" 和 "sample_file" 來指定數(shù)據(jù)來源為 CSV 文件,來實現(xiàn)導(dǎo)入已有數(shù)據(jù)的功能。CSV 為半角逗號分隔的數(shù)據(jù)文件,每行數(shù)據(jù)列數(shù)需要和表的數(shù)據(jù)列數(shù)(如果是標(biāo)簽數(shù)據(jù),是和標(biāo)簽數(shù))相同。

使用 taosBenchmark 進(jìn)行查詢和訂閱測試

taosBenchmark 不僅僅可以進(jìn)行數(shù)據(jù)寫入,也可以執(zhí)行查詢和訂閱功能。但一個 taosBenchmark 實例只能支持其中的一種功能,不能同時支持三種功能,通過配置文件來指定進(jìn)行哪種功能的測試。

以下為一個典型查詢 JSON 示例文件內(nèi)容:

{
  "filetype": "query",
  "cfgdir": "/etc/taos",
  "host": "127.0.0.1",
  "port": 6030,
  "user": "root",
  "password": "taosdata",
  "confirm_parameter_prompt": "no",
  "databases": "db",
  "query_times": 2,
  "query_mode": "taosc",
  "specified_table_query": {
    "query_interval": 1,
    "concurrent": 3,
    "sqls": [
      {
        "sql": "select last_row(*) from stb0 ",
        "result": "./query_res0.txt"
      },
      {
        "sql": "select count(*) from stb00_1",
        "result": "./query_res1.txt"
      }
    ]
  },
  "super_table_query": {
    "stblname": "stb1",
    "query_interval": 1,
    "threads": 3,
    "sqls": [
      {
        "sql": "select last_row(ts) from xxxx",
        "result": "./query_res2.txt"
      }
    ]
  }
}

以下為 JSON 文件中和查詢相關(guān)的特有參數(shù)含義:

"query_times": 每種查詢類型的查詢次數(shù)
"query_mode": 查詢數(shù)據(jù)接口,"taosc":調(diào)用TDengine的c接口;“restful”:使用 RESTful 接口。可選項。缺省是“taosc”。
"specified_table_query": { 指定表的查詢
"query_interval": 執(zhí)行 sqls 的間隔,單位是秒。可選項,缺省是0。
"concurrent": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程都執(zhí)行所有的 sqls。
"sqls": 可以添加多個 SQL 語句,最多支持 100 條。
"sql": 查詢語句。必選項。
"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。
"super_table_query": { 對超級表中所有子表的查詢
"stblname": 超級表名稱。必選項。
"query_interval": 執(zhí)行 sqls 的間隔,單位是秒??蛇x項,缺省是0。
"threads": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程負(fù)責(zé)一部分子表,執(zhí)行所有的 sqls。
"sql": "SELECT COUNT(*) FROM xxxx"。查詢超級表內(nèi)所有子表的查詢語句,其中表名必須寫成 “xxxx”,實例會自動替換成子表名。
"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。

以下為一個典型訂閱 JSON 示例文件內(nèi)容:

{
    "filetype":"subscribe",
    "cfgdir": "/etc/taos",
    "host": "127.0.0.1",
    "port": 6030,
    "user": "root",
    "password": "taosdata",
    "databases": "db",
    "confirm_parameter_prompt": "no",
    "specified_table_query":
      {
       "concurrent":1,
       "mode":"sync",
       "interval":0,
       "restart":"yes",
       "keepProgress":"yes",
       "sqls": [
        {
          "sql": "select * from stb00_0 ;",
          "result": "./subscribe_res0.txt"
        }]
      },
    "super_table_query":
      {
       "stblname": "stb0",
       "threads":1,
       "mode":"sync",
       "interval":10000,
       "restart":"yes",
       "keepProgress":"yes",
       "sqls": [
        {
          "sql": "select * from xxxx where ts > '2021-02-25 11:35:00.000' ;",
          "result": "./subscribe_res1.txt"
        }]
      }
  }

以下為訂閱功能相關(guān)的特有參數(shù)含義:

"interval": 執(zhí)行訂閱的間隔,單位是秒??蛇x項,缺省是0。
"restart": 訂閱重啟。"yes":如果訂閱已經(jīng)存在,重新開始,"no": 繼續(xù)之前的訂閱。(請注意執(zhí)行用戶需要對 dataDir 目錄有讀寫權(quán)限)
"keepProgress": 保留訂閱信息進(jìn)度。yes表示保留訂閱信息,no表示不保留。該值為yes,restart為no時,才能繼續(xù)之前的訂閱。
"resubAfterConsume": 配合 keepProgress 使用,在訂閱消費了相應(yīng)次數(shù)后調(diào)用 unsubscribe 取消訂閱并再次訂閱。
"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。 注意:每條 SQL 語句后的保存結(jié)果的文件不能重名,且生成結(jié)果文件時,文件名會附加線程號。

結(jié)語

TDengine是濤思數(shù)據(jù)專為物聯(lián)網(wǎng)、車聯(lián)網(wǎng)、工業(yè)互聯(lián)網(wǎng)、IT運維等設(shè)計和優(yōu)化的大數(shù)據(jù)平臺。TDengine 由于數(shù)據(jù)庫內(nèi)核中創(chuàng)新的數(shù)據(jù)存儲和查詢引擎設(shè)計,展現(xiàn)出遠(yuǎn)超同類產(chǎn)品的高效性能。并且由于支持 SQL 語法和多種編程語言的連接器(目前支持 Java, Python, Go, C#, Node.js, Rust 等),易用性極強(qiáng),學(xué)習(xí)成本為零。為了便于運維需求,我們還提供數(shù)據(jù)遷移和監(jiān)控功能等相關(guān)生態(tài)工具軟件。

為了剛接觸 TDengine 的使用者方便進(jìn)行技術(shù)評估和壓力測試,我們?yōu)?taosBenchmark 開發(fā)了豐富的特性。本文即為對 taosBenchmark 的一個簡單介紹,隨著 TDengine 新功能的不斷增加,taosBenchmark 也會繼續(xù)演化和改進(jìn)。taosBenchmark 的代碼做為 TDengine 的一部分在 GitHub 上完全開源。歡迎就 taosBenchmark 或 TDengine 的使用或?qū)崿F(xiàn)在 GitHub 或者濤思數(shù)據(jù)的用戶群提出建議或批評。

附錄 - 完整 taosBenchmark 參數(shù)介紹

taosBenchmark支持兩種配置參數(shù)的模式,一種是命令行參數(shù),一種是使用 JSON 格式的配置文件。

一、命令行參數(shù)

-f:指定 taosBenchmark 所需參數(shù)的 JSON 配置文件。當(dāng)使用該參數(shù)時,其他所有命令行參數(shù)都失效??蛇x項,缺省是 NULL。目前僅支持不含 BOM(byte-order mark)的標(biāo)準(zhǔn) UTF-8 編碼文件。

-u: 用戶名。可選項,缺省是“root“。

-p: 密碼。可選項,缺省是“taosdata"。指定密碼需要使用 MySQL 風(fēng)格,即密碼和 -p 貼緊方式,中間無空格。

-c: 配置文件taos.cfg所在的路徑。因為taosBenchmark通過包含taos的動態(tài)庫,去鏈接taosd服務(wù),所以需要做好配置文件??蛇x項,缺省是 "/etc/taos"路徑。

-h:taosd服務(wù)的FQDN。可選項,缺省是“l(fā)ocalhost“。

-P: taosd服務(wù)的端口號??蛇x項,缺省是6030。

-d:數(shù)據(jù)庫名稱??蛇x項,缺省是“test”。

-a:副本個數(shù),可選項。1 - 3,缺省是1。

-m:表名的前綴。可選項,缺省是“t”。

-s::執(zhí)行該文件包含的多條 SQL 查詢命令。

-N:使用普通建表模式。有該選項時,全部創(chuàng)建普通表,否則缺省創(chuàng)建超級表,再根據(jù)超級表創(chuàng)建子表;

-o:指定執(zhí)行結(jié)果輸出文件的路徑。可選項,缺省是./output.txt。

-q:查詢模式,0:同步模式;1:異步模式??蛇x項,缺省是0。

-b:列的類型。可選項,缺省是:FLOAT,INT,FLOAT。NCHAR和BINARY也可以自定義長度,例如: NCHAR(16), BINARY(8)

-w:BINARY或NCHAR數(shù)據(jù)類型的長度??蛇x項,缺省是16。

-l:列的個數(shù)??蛇x項,缺省是3。

-T:并發(fā)線程數(shù)??蛇x項,缺省是10。

-i:兩次 SQL 插入的休眠時間間隔,缺省是0。

-S:兩次插入間隔時間戳步長,缺省是1。

-B:交錯(interlace)寫入模式,缺省是0(順序?qū)懭肽J剑?/p>

-r:每條插入請求包含的記錄數(shù),缺省是30000。

-t:表的個數(shù)??蛇x項,缺省是10000。

-n:每個表插入的記錄數(shù)??蛇x項,缺省是10000。

-M: 插入數(shù)據(jù)為完全隨機(jī)。可選項,缺省為模擬能源設(shè)備真實場景(數(shù)據(jù)在固定范圍小幅波動)。

-x:不僅僅插入數(shù)據(jù)。有該選項時,taosBenchmark還會進(jìn)行聚合函數(shù)查詢操作。

-y:提示詢問輸入時缺省輸入yes。

-O:插入亂序數(shù)據(jù)的比例,0:順序插入;> 0:亂序數(shù)據(jù)的百分比??蛇x項,缺省是0。、

-R:亂序百分比不為0時,亂序時間戳范圍,單位:毫秒??蛇x項,缺省是1000。

-g:打印debug信息

-V: 打印taosBenchmark的debug信息。

--help: 打印命令參數(shù)列表。

二、JSON 格式的配置文件中所有參數(shù)說明

taosBenchmark支持3種功能的測試,包括插入、查詢、訂閱。但一個taosBenchmark實例不能同時支持三種功能,一個 taosBenchmark 實例只能支持其中的一種功能,通過配置文件來指定進(jìn)行哪種功能的測試。

1、插入功能測試的 JSON 配置文件

{
    "filetype": "insert",
    "cfgdir": "/etc/taos",
    "host": "127.0.0.1",
    "port": 6030,
    "user": "root",
    "password": "taosdata",
    "thread_count": 4,
    "thread_count_create_tbl": 4,
    "result_file": "./insert_res.txt",
    "confirm_parameter_prompt": "no",
    "insert_interval": 0,
    "interlace_rows": 100,
    "num_of_records_per_req": 100,
    "databases": [{
        "dbinfo": {
            "name": "db",
            "drop": "yes",
            "replica": 1,
            "days": 10,
            "cache": 16,
            "blocks": 8,
            "precision": "ms",
            "keep": 3650,
            "minRows": 100,
            "maxRows": 4096,
            "comp":2,
            "walLevel":1,
            "cachelast":0,
            "quorum":1,
            "fsync":3000,
            "update": 0
        },
        "super_tables": [{
            "name": "stb",
            "child_table_exists":"no",
            "childtable_count": 100,
            "childtable_prefix": "stb_",
            "auto_create_table": "no",
            "batch_create_tbl_num": 5,
            "data_source": "rand",
            "insert_mode": "taosc",
            "insert_rows": 100000,
            "childtable_limit": 10,
            "childtable_offset":100,
            "interlace_rows": 0,
            "insert_interval":0,
            "max_sql_len": 1024000,
            "disorder_ratio": 0,
            "disorder_range": 1000,
            "timestamp_step": 10,
            "start_timestamp": "2020-10-01 00:00:00.000",
            "sample_format": "csv",
            "sample_file": "./sample.csv",
            "use_sample_ts": "no",
            "tags_file": "",
            "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}],
            "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
        }]
    }]
}

"filetype": 本taosBenchmark實例進(jìn)行哪種功能測試。"insert"表示數(shù)據(jù)插入功能。必選項。

"cfgdir": 配置文件taos.cfg所在的路徑。因為taosBenchmark通過包含taos的動態(tài)庫,去鏈接taosd服務(wù),所以需要做好配置文件。可選項,缺省是 "/etc/taos"路徑。

"host": taosd服務(wù)的FQDN??蛇x項,缺省是“l(fā)ocalhost“。

"port": taosd服務(wù)的端口號。可選項,缺省是6030。

"user": 用戶名。可選項,缺省是“root“。

"password": 密碼??蛇x項,缺省是“taosdata"。

"thread_count": 插入數(shù)據(jù)時的并發(fā)線程數(shù)??蛇x項,缺省是1。

"thread_count_create_tbl": 建子表時的并發(fā)線程數(shù)??蛇x項,缺省是1。

"result_file": 測試完成后結(jié)果保存文件。可選項,缺省是本實例啟動目錄下的"./insert_res.txt"。

"confirm_parameter_prompt": 執(zhí)行過程中提示是否確認(rèn),為no時,執(zhí)行過程無需手工輸入enter。可選項,缺省是no。

"insert_interval": 兩次發(fā)送請求的間隔時間。可選項,缺省是0,代表無人工設(shè)置的時間間隔,單位為ms。。

"interlace_rows": 設(shè)置輪詢插入每個單表數(shù)據(jù)的條目數(shù),如果 interlace_rows childtable_count supertable_num 小于 num_of_records_per_req 時,則請求插入的數(shù)目以 interlace_rows childtable_count supertable_num 為準(zhǔn)??蛇x項,缺省是 0。

"num_of_records_per_req": 每條請求數(shù)據(jù)內(nèi)容包含的插入數(shù)據(jù)記錄數(shù)目,該數(shù)據(jù)組成的 SQL 不能大于 maxSqlLen,如果過大,則取 taosd 限制的1M長度(1048576)。0 代表不插入數(shù)據(jù),建議配置大于 0。

"databases": [{

"dbinfo": {"name": 數(shù)據(jù)庫名稱。必選項。

"drop": 如果數(shù)據(jù)庫已經(jīng)存在,”yes“:刪除后重建;”no“:不刪除,直接使用??蛇x項,缺省是”no“。drop = yes 會使其他子表創(chuàng)建相關(guān)條目無效。

"replica": 副本個數(shù),可選項。1 - 3,缺省是1。

"days": 數(shù)據(jù)文件存儲數(shù)據(jù)的時間跨度,可選項。缺省是10天。

"cache": 內(nèi)存塊的大小,單位是MB,可選項。缺省是16MB。

"blocks": 每個VNODE(TSDB)中有多少cache大小的內(nèi)存塊,可選項。缺省是6塊。

"precision": 數(shù)據(jù)庫時間精度,可選項。"ms":毫秒, “us”:微秒。缺省是“ms”。in

"keep": 數(shù)據(jù)保留的天數(shù),可選項。缺省是3650天。

"minRows": 文件塊中記錄的最小條數(shù),可選項。缺省是100。

"maxRows": 文件塊中記錄的最大條數(shù),可選項。缺省是4096.

"comp":文件壓縮標(biāo)志位,可選項。0:關(guān)閉,1:一階段壓縮,2:兩階段壓縮。缺省是2。

"walLevel":WAL級別,可選項。1:寫wal, 但不執(zhí)行fsync; 2:寫wal, 而且執(zhí)行fsync。缺省是1。

"cachelast":允許在內(nèi)存中保留每張表的最后一條記錄。1表示允許。

"quorum":異步寫入成功所需應(yīng)答之法定數(shù),1-3,可選項。缺省是1。

"fsync":當(dāng)wal設(shè)置為2時,執(zhí)行fsync的周期,單位是毫秒,最小為0,表示每次寫入,立即執(zhí)行fsync. 最大為180000,可選項。缺省是3000。

"update": 支持?jǐn)?shù)據(jù)更新,0:否;1:是??蛇x項。缺省是0。 ? },

"super_tables": [{ ? "name": 超級表名稱,必選項。

"child_table_exists": 子表是否已經(jīng)存在,“yes”:是;"no":否。指定“是”后,不再建子表,后面相關(guān)子表的參數(shù)就無效了。可選項,缺省是“no”。database 設(shè)置 drop = yes 時,無論配置文件內(nèi)容,此參數(shù)將自動置為 no。

"childtable_count": 建立子表個數(shù) 。該值需要大于0。當(dāng)child_table_exists為“no”時,必選項,否則就是無效項。

"childtable_prefix": 子表名稱前綴。當(dāng)child_table_exists為“no”時,必選項,否則就是無效項。確保數(shù)據(jù)庫中表名沒有重復(fù)。

"auto_create_table": 子表的創(chuàng)建方式,“yes”:自動建表;"no":提前建表??蛇x項,缺省是“no”。當(dāng) child_table_exists 為 “yes” 時此參數(shù)將自動置為 no 。

"batch_create_tbl_num": 一個 SQL 批量創(chuàng)建子表的數(shù)目。

"data_source": 插入數(shù)據(jù)來源,"rand":實例隨機(jī)生成;“sample”:從樣例文件中讀取。可選項。缺省是“rand”。

"insert_mode": 插入數(shù)據(jù)接口,"taosc":調(diào)用TDengine的c接口;“rest”:使用 RESTful 接口;“stmt”:使用 stmt (參數(shù)綁定)接口 (目前僅在 develop 分支代碼中)。可選項。缺省是“taosc”。

"insert_rows": 插入記錄數(shù),0:一直插入,永不退出;>0:每個子表插入記錄數(shù),完成后實例退出??蛇x項,缺省是0。

"childtable_offset": 插入數(shù)據(jù)時,子表起始值。只在drop=no && child_table_exists= yes,該字段生效。

"childtable_limit": 插入數(shù)據(jù)時,子表從offset開始,偏移的表數(shù)目。使用者可以運行多個 taosBenchmark 實例(甚至可以在不同的機(jī)器上)通過使用不同的 childtable_offset 和 childtable_limit 配置值來實現(xiàn)同時寫入相同數(shù)據(jù)庫相同超級表下多個子表。只在drop=no && child_table_exists= yes,該字段生效。

"interlace_rows": 跟上面的配置一致,不過該處的配置優(yōu)先,每個stable可以有自己單獨的配置。最大不超過 num_of_records_per_req。

"insert_interval": 同上。

"max_sql_len": 同上

"disorder_ratio": 插入數(shù)據(jù)時的亂序百分比,可選項,缺省是0。

"disorder_range": 亂序百分比不為0時,亂序時間戳范圍,單位:ms。可選項,缺省是1000,即1秒或1000毫秒。

"timestamp_step": 每個子表中記錄時間戳的步長,單位:ms??蛇x項,缺省是1,即1毫秒。

"start_timestamp": 子表中記錄時間戳的起始值,支持"2020-10-01 00:00:00.000"和“now”兩種格式,可選項,缺省是“now”。

"sample_format": 當(dāng)插入數(shù)據(jù)源選擇“sample”時,sample文件的格式,"csv":CSV 格式,每列的值與子表的 columns 保持一致,但不包含第1列的時間戳。可選項,缺省是”csv”。目前僅僅支持 CSV 格式的 sample 文件。

"sample_file":sample文件,包含路徑和文件名。當(dāng)插入數(shù)據(jù)源選擇“sample”時,該項為必選項。

"use_sample_ts":sample 文件是否包含第一列時間戳,可選項: "yes" 和 "no", 默認(rèn) "no"。(注意:若為 yes,則 disorder_ratio 和 disorder_range 失效)

"tags_file": 子表 tags 值文件,只能是 CSV 文件格式,且必須與超級表的tags保持一致。當(dāng)該項為非空時,表示子表的tags值從文件中獲?。粸榭諘r,實例隨機(jī)生成??蛇x項,缺省是空。

"columns": [{ 超級表的 column 列表,最大支持 4096 列(指所有普通列+超級列總和)。默認(rèn)的第一列為時間類型,程序自動添加,不需要手工添加。

"type": 該列的數(shù)據(jù)類型 ,必選項。

"len": 該列的長度,只有 type 是 BINARY 或 NCHAR 時有效,可選項,缺省值是 8。

"count":該類型的連續(xù)列個數(shù),可選項,缺省是 1。

}],

"tags": [{ 超級表的 tags 列表,type不能是 TIMESTAMP 類型, 最大支持 128 個。

"type": 該列的數(shù)據(jù)類型 ,必選項。

"len": 該列的長度,只有 type 是 BINARY 或 NCHAR 時有效,可選項,缺省值是 8。

"count":該類型的連續(xù)列個數(shù),可選項,缺省是 1。

}]

2、查詢功能測試的 JSON 配置文件

{
  "filetype": "query",
  "cfgdir": "/etc/taos",
  "host": "127.0.0.1",
  "port": 6030,
  "user": "root",
  "password": "taosdata",
  "confirm_parameter_prompt": "no",
  "databases": "db",
  "query_times": 2,
  "query_mode": "taosc",
  "specified_table_query": {
    "query_interval": 1,
    "concurrent": 3,
    "sqls": [
      {
        "sql": "select last_row(*) from stb0 ",
        "result": "./query_res0.txt"
      },
      {
        "sql": "select count(*) from stb00_1",
        "result": "./query_res1.txt"
      }
    ]
  },
  "super_table_query": {
    "stblname": "stb1",
    "query_interval": 1,
    "threads": 3,
    "sqls": [
      {
        "sql": "select last_row(ts) from xxxx",
        "result": "./query_res2.txt"
      }
    ]
  }
}

"filetype": 本taosBenchmark實例進(jìn)行哪種功能測試。"query"表示數(shù)據(jù)查詢功能。必選項。

"cfgdir": 配置文件taos.cfg所在的路徑。因為taosBenchmark通過包含taos的動態(tài)庫,去鏈接taosd服務(wù),所以需要做好配置文件??蛇x項,缺省是 "/etc/taos"路徑。

"host": taosd服務(wù)的FQDN??蛇x項,缺省是“l(fā)ocalhost“。

"port": taosd服務(wù)的端口號??蛇x項,缺省是6030。

"user": 用戶名??蛇x項,缺省是“root“。

"password": 密碼??蛇x項,缺省是“taosdata"。

"confirm_parameter_prompt": 執(zhí)行過程中提示是否確認(rèn),為no時,執(zhí)行過程無需手工輸入enter??蛇x項,缺省是no。

"databases": 數(shù)據(jù)庫名稱。必選項。

"query_times": 每種查詢類型的查詢次數(shù)

"query_mode": 查詢數(shù)據(jù)接口,"taosc":調(diào)用TDengine的c接口;“restful”:使用 RESTful 接口。可選項。缺省是“taosc”。

"specified_table_query": { 指定表的查詢

"query_interval": 執(zhí)行 sqls 的間隔,單位是秒??蛇x項,缺省是0。

"concurrent": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程都執(zhí)行所有的 sqls。

"sqls": 可以添加多個 SQL 語句,最多支持100條。

"sql": 查詢語句。必選項。

"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。

"super_table_query": { 對超級表中所有子表的查詢

"stblname": 超級表名稱。必選項。

"query_interval": 執(zhí)行 sqls 的間隔,單位是秒??蛇x項,缺省是0。

"threads": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程負(fù)責(zé)一部分子表,執(zhí)行所有的 sqls。

"sql": "select count(*) from xxxx"。查詢超級表內(nèi)所有子表的查詢語句,其中表名必須寫成 “xxxx”,實例會自動替換成子表名。

"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。

注意:每條 SQL 語句后的保存結(jié)果的文件不能重名,且生成結(jié)果文件時,文件名會附加線程號。

查詢結(jié)果顯示:如果查詢線程結(jié)束一次查詢距開始執(zhí)行時間超過30秒打印一次查詢次數(shù)、用時和QPS。所有查詢結(jié)束時,匯總打印總的查詢次數(shù)和QPS。

3、訂閱功能測試的 JSON 配置文件

{
    "filetype":"subscribe",
    "cfgdir": "/etc/taos",
    "host": "127.0.0.1",
    "port": 6030,
    "user": "root",
    "password": "taosdata",
    "databases": "db",
    "confirm_parameter_prompt": "no",
    "specified_table_query":
      {
       "concurrent":1,
       "mode":"sync",
       "interval":0,
       "restart":"yes",
       "keepProgress":"yes",
       "sqls": [
        {
          "sql": "select * from stb00_0 ;",
          "result": "./subscribe_res0.txt"
        }]
      },
    "super_table_query":
      {
       "stblname": "stb0",
       "threads":1,
       "mode":"sync",
       "interval":10000,
       "restart":"yes",
       "keepProgress":"yes",
       "sqls": [
        {
          "sql": "select * from xxxx where ts > '2021-02-25 11:35:00.000' ;",
          "result": "./subscribe_res1.txt"
        }]
      }
}

"filetype": 本taosBenchmark實例進(jìn)行哪種功能測試。"subscribe"表示數(shù)據(jù)查詢功能。必選項。**

"cfgdir": 配置文件taos.cfg所在的路徑。因為taosBenchmark通過包含taos的動態(tài)庫,去鏈接taosd服務(wù),所以需要做好配置文件??蛇x項,缺省是 "/etc/taos"路徑。

"host": taosd服務(wù)的FQDN。可選項,缺省是“l(fā)ocalhost“。

"port": taosd服務(wù)的端口號??蛇x項,缺省是6030。

"user": 用戶名??蛇x項,缺省是“root“。

"password": 密碼??蛇x項,缺省是“taosdata"。

"databases": 數(shù)據(jù)庫名稱。必選項。**

"confirm_parameter_prompt": 執(zhí)行過程中提示是否確認(rèn),為no時,執(zhí)行過程無需手工輸入enter??蛇x項,缺省是no。

注意:這里的訂閱查詢 SQL 目前只支持 SELECT * ,其余不支持。

"specified_table_query": 指定表的訂閱。

"concurrent": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程都執(zhí)行所有的 sqls。

"mode": 訂閱模式。目前支持同步和異步訂閱,缺省是sync。

"interval": 執(zhí)行訂閱的間隔,單位是秒??蛇x項,缺省是0。

"restart": 訂閱重啟。"yes":如果訂閱已經(jīng)存在,重新開始,"no": 繼續(xù)之前的訂閱。(請注意執(zhí)行用戶需要對 dataDir 目錄有讀寫權(quán)限)

"keepProgress": 保留訂閱信息進(jìn)度。yes表示保留訂閱信息,no表示不保留。該值為yes,restart為no時,才能繼續(xù)之前的訂閱。

"resubAfterConsume": 配合 keepProgress 使用,在訂閱消費了相應(yīng)次數(shù)后調(diào)用 unsubscribe 取消訂閱并再次訂閱。

"sql": 查詢語句。必選項。

"result": 查詢結(jié)果寫入的文件名。可選項,缺省是空,表示查詢結(jié)果不寫入文件。

"super_table_query": 對超級表中所有子表的訂閱。

"stblname": 超級表名稱。必選項。

"threads": 并發(fā)執(zhí)行 sqls 的線程數(shù),可選項,缺省是1。每個線程都執(zhí)行所有的 sqls。

"mode": 訂閱模式。

"interval": 執(zhí)行 sqls 的間隔,單位是秒。可選項,缺省是 0。

"restart": 訂閱重啟。"yes":如果訂閱已經(jīng)存在,重新開始,"no": 繼續(xù)之前的訂閱。

"keepProgress": 保留訂閱信息進(jìn)度。yes表示保留訂閱信息,no表示不保留。該值為yes,restart為no時,才能繼續(xù)之前的訂閱。

"resubAfterConsume": 配合 keepProgress 使用,在訂閱消費了相應(yīng)次數(shù)后調(diào)用 unsubscribe 取消訂閱并再次訂閱。

"sql": " SELECT COUNT(*) FROM xxxx "。查詢語句,其中表名必須寫成 “xxxx”,實例會自動替換成子表名。

"result": 查詢結(jié)果寫入的文件名??蛇x項,缺省是空,表示查詢結(jié)果不寫入文件。 注意:每條 SQL 語句后的保存結(jié)果的文件不能重名,且生成結(jié)果文件時,文件名會附加線程號。