19 Ekim 2021 Salı

SQL - CREATE TABLE WITH TEMPLATE

Giriş
Açıklaması şöyle. Hazır iki tane template var. Bunlar PARTITIONED ve REPLICATED. Eğer hiç bir şey tanımlamazsak PARTITIONED kullanılır
TEMPLATE=<cache’s template name> - case-sensitive​ name of a cache template. A template is an instance of the CacheConfiguration class registered by calling Ignite.addCacheConfiguration().

Use predefined TEMPLATE=PARTITIONED or TEMPLATE=REPLICATED templates to create the cache with the corresponding replication mode. The rest of the parameters will be those that are defined in the CacheConfiguration object. By default, TEMPLATE=PARTITIONED is used if the template is not specified explicitly.
1. Partitioned Ne Demek?
Açıklaması şöyle
PARTITIONED means data is spread across nodes by a key, like sharding in MongoDB, or partitioning in Kafka and Cassandra.
Ne Zaman Partitioned Kullanılır?
Açıklaması şöyle
Partitioned caches are ideal when working with large data sets and updates are frequent.
Partitioned ve Backup Sayısı
Açıklaması şöyle
Additionally to the PARTITIONED mode, you can setup the number of backups. This is the number of nodes backing up the primary node, but not serving any requests. Writes to backup copies can be done synchronously or asynchronously.
2. REPLICATED Ne Demek?
Açıklaması şöyle
REPLICATED is about storing all data on each node.
Ne Zaman Replicated Kullanılır?
Açıklaması şöyle
This mode is ideal for scenarios where cache reads are a lot more frequent than cache writes, and data sets are small.

Örnek - replicated
Açıklaması şöyle
By default, the template mode is PARTITIONED. To specify the number of copies of the data we can also specify BACKUPS parameter here, which is 0 by default.
Şöyle yaparız
CREATE TABLE Employee (
id LONG PRIMARY KEY, name VARCHAR, isEmployed tinyint(1) ) WITH "template=replicated";
Örnek - partitioned
Şöyle yaparız
CREATE TABLE 'city' (
 'ID' INT(11),
 'Name' CHAR(35),
 'CountryCode' CHAR(3),
 PRIMARY KEY('ID','CountryCode')
) WITH "template=partitioned, backups=1, affinityKey=CountryCode";

Hiç yorum yok:

Yorum Gönder

Ignite Transaction Kullanımı

Giriş Bir tablo 3 tane atomicity değerinden birisine sahip olabilir. 1. ATOMIC 2. TRANSACTIONAL 3. TRANSACTIONAL_SNAPSHOT ATOMIC Açıklaması ...