You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by "Tian Jiang (JIRA)" <ji...@apache.org> on 2019/07/17 11:06:00 UTC

[jira] [Closed] (IOTDB-122) Support prepared insertion

     [ https://issues.apache.org/jira/browse/IOTDB-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tian Jiang closed IOTDB-122.
----------------------------

> Support prepared insertion
> --------------------------
>
>                 Key: IOTDB-122
>                 URL: https://issues.apache.org/jira/browse/IOTDB-122
>             Project: Apache IoTDB
>          Issue Type: New Feature
>            Reporter: Tian Jiang
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> As some have mentioned, sql parser(antlr) may consume about 40% of time in ingestion, especially when small sqls executed sent frequently. Luckily, IoTDB insertion sqls are currently all alike and simple, there are 4 most meaningful parts of such sqls: deviceId, measurements, values and time. For such a simple structure, using tools like antlr may be just too heavy.
> Intuitively, PreparedStatement in Standard JDBC interface can be just used for reliving parsing overhead when sqls are similar. I will describe how PreparedStatement works as follow (this is still left to be implemented):
> 1. The user wants to create a prepared insert statement and called `connection.prepareStatement(“Insert”)`;
> 2. The connection matches the parameter string with some templates, finds out it is an insertion and returns an IoTDBPreparedInsertStatement pStmt.
> 3. The user calls `pStmt.setDevice(“root.device1”); pStmt.setTime(100); pStmt.setMeasurements(measurementArray); pStmt.setValues(valueArray);` to set parameters for next insertion.
> 4. The user calls `pStmt.execute()` to execute an insertion.
> 5. The PreparedInsertStatement creates a TSInsertionReq, puts deviceId, measurements, values and time into this request and sends this request to the server.
> 6. The server receives the request, extracts parameters from the request and executes an insertion directly through database engine and return a TSInsertionResp to the user.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)