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

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;
...
}
主站蜘蛛池模板: 通许县| 蒲江县| 镇平县| 油尖旺区| 大庆市| 五台县| 伽师县| 和平区| 台湾省| 洪雅县| 新密市| 平遥县| 绵竹市| 昆山市| 康乐县| 云浮市| 屯留县| 丹棱县| 乡宁县| 赤壁市| 深泽县| 哈密市| 南昌县| 镇康县| 镇沅| 安仁县| 尉犁县| 乌拉特前旗| 上林县| 巧家县| 黄大仙区| 吉林省| 尚志市| 鄂州市| 当阳市| 宾阳县| 乐东| 凤阳县| 南宁市| 柳州市| 从化市|