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

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;
...
}
主站蜘蛛池模板: 江阴市| 汾阳市| 玛多县| 孝感市| 乡城县| 龙陵县| 赤城县| 凤山市| 通城县| 安远县| 陵水| 古浪县| 广东省| 萝北县| 民丰县| 平度市| 诸城市| 崇文区| 韩城市| 双鸭山市| 依安县| 沁阳市| 当雄县| 西乌珠穆沁旗| 衡水市| 儋州市| 大冶市| 绥江县| 高台县| 合阳县| 尉犁县| 秦安县| 日土县| 霍林郭勒市| 京山县| 新密市| 武功县| 勐海县| 瑞丽市| 大埔县| 丰城市|