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

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;
...
}
主站蜘蛛池模板: 马关县| 海林市| 花莲市| 阿城市| 关岭| 山阳县| 安达市| 芮城县| 康保县| 屏山县| 额尔古纳市| 开原市| 綦江县| 海原县| 海淀区| 平泉县| 宜都市| 太仆寺旗| 体育| 开远市| 贵南县| 腾冲县| 昭通市| 祥云县| 华阴市| 佛山市| 辰溪县| 宁国市| 洛阳市| 荃湾区| 沾益县| 贵德县| 五大连池市| 昌吉市| 临清市| 宁远县| 大悟县| 龙州县| 鹤壁市| 萨迦县| 博爱县|