官术网_书友最值得收藏!

In-Memory SQL Grid (IMSG)

Apache Ignite SQL Grid is a distributed data grid where you can execute ANSI SQL-99-compliant SQLs (SELECT, UPDATE, INSERT, MERGE, and DELETE queries) to manipulate a cache. The Apache Ignite cache API provides you with the get/put/remove methods (and variants) to interact with the cache, but the SQL API offers you more flexibility; for instance, you can execute a SELECT query to fetch objects or update a few specific records using a where clause, or delete objects from a cache.

 Applications developed in different languages can interact with the Ignite platform with their native APIs and ANSI SQL-99 syntax through Apache Ignite's JDBC and ODBC APIs. Suppose you want to store student information in a database table called student. In the in-memory world, you can create a student cache to store data. The student cache will store the student ID as the key and the student object as the value. If you know the student id, you can easily fetch the student details by calling cache.get(studentId). SQL grid APIs enable you to query the student using its fields—such as you can query:

 SELECT * FROM student WHERE firstName = 'john'

The student class needs to be serializable. The following is the Student class code snippet. Some fields are annotated with @QuerySqlField to make them queriable. You can write an SQL query to fetch students data with studentId, firstName, or lastName. We will cover the indexing in SQL section:

public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@QuerySqlField(index = true)
private Long studentId;
@QuerySqlField(index= true)
private String firstName;
@QuerySqlField(index= true)
private String lastName;
...
}
主站蜘蛛池模板: 莲花县| 嵊泗县| 义马市| 阜康市| 滁州市| 惠来县| 沙坪坝区| 孟连| 铜山县| 定南县| 藁城市| 庄浪县| 玛曲县| 株洲市| 铅山县| 沭阳县| 巴彦淖尔市| 黔西县| 凌海市| 景谷| 台山市| 太湖县| 藁城市| 虞城县| 多伦县| 双桥区| 江山市| 汕尾市| 商城县| 石泉县| 神池县| 石泉县| 通辽市| 鄂州市| 平度市| 柞水县| 临洮县| 台东市| 通辽市| 临西县| 邵武市|