AlloyDB offers a fully-managed database system that is compatible with PostgreSQL created by Google Cloud. By leveraging the power of Google Cloud, AlloyDB separates the database layer from the storage layer, resulting in increased scalability, elasticity, and fault tolerance, which significantly improves system performance. The disaggregated storage layer first handles write operations by writing the write-ahead log (WAL) to storage in low latency. A log processing service (LPS) then processes these WAL records and generates database blocks. The storage layer can be independently sharded and replicated for durability due to its disaggregated nature. For read operations, the read query can be processed either by the primary instance or a replica instance and results are returned if the data block is in the instance’s memory cache. If not, a fetch request is sent to the storage layer. AlloyDB further extends the caching capacity of the read instance by using local SSD as cache as well.
The other major optimization in AlloyDB is the use of adaptive columnar engine, memory management and vacuum. The adaptive columnar engine utilizes a machine learning approach to determine the optimal data storage format for the workload and applies potential optimizations for query processing. Additionally, AlloyDB employs automatically adjusted memory management and vacuum techniques to ensure efficient resource allocation within the system.
In AlloyDB, WAL records are written to the storage layer synchronously. Then, the log processing service in the storage layer is responsible for replaying the logs continuously. AlloyDB supports checkpoints but there is no need for flushing the changes in the database layer to the storage layer.
Multi-version Concurrency Control (MVCC) Two-Phase Locking (Deadlock Detection)
AlloyDB supports MVCC and Two-Phase Locking.
Hash Table Bw-Tree Inverted Index (Full Text) Block Range Index (BRIN)
The concurrency control AlloyDB uses is the same as in PostgreSQL and PostgreSQL supports B-tree, Hash, GIST, SP-GIST, GIN and BRIN index types.
Read Uncommitted Read Committed Serializable Repeatable Read
Isolation level in AlloyDB can be set through database flag "default_transaction_isolation", where it can be set to either “read uncommitted”, “read committed”, “repeatable read”, or “serializable”.
Nested Loop Join Hash Join Sort-Merge Join Index Nested Loop Join
AlloyDB builds on PostgreSQL where PostgreSQL supports the following three join strategies: nested loop join and it is possible to utilize the values from the row of the left relation as keys for scanning the right relation's index given that the right relation can be processed with index scan, merge join and hash join.
Intra-Operator (Horizontal) Inter-Operator (Vertical)
AlloyDB employs PostgreSQL, which enables both inter-operation parallelism, allowing for parallel execution of parts of the plan, and intraoperator parallelism, enabling partitioning and sharing of specific operators such as scans, joins, aggregation, and append across multiple processes.
N-ary Storage Model (Row/Record)
AlloyDB stores the data in the storage layer following the same format as PostgreSQL. However, a columnar engine is used where the data that gets loaded into memory can take on either the row-based format or the columnar format based on the workload, which is decided using machine learning models. As a result, query optimizations relating to columnar formats can be applied to the relevant data.
AlloyDB disaggregates its database layer and its storage layer. As a result, each component of the database system becomes more elastic to scale. AlloyDB refers to the main unit of resource as a cluster, which consists of one primary instance and multiple read pool instances. The primary instance handles read/write requests while the read pool instances only have read access. The storage layer is shared between all cluster resources.
Virtual Views Materialized Views
AlloyDB follows the same rule as PostgreSQL where both Materialized Views and Virtual Views are supported.
https://cloud.google.com/alloydb
https://cloud.google.com/alloydb/docs/
2022