Block As a Value for SQL Over Nosql

Block As a Value for SQL Over Nosql

Block as a Value for SQL over NoSQL Yang Cao1 Wenfei Fan1,2,3 Tengfei Yuan1 1University of Edinburgh 2Beihang University 3SICS, Shenzhen University {yang.cao@, wenfei@inf., tengfei.yuan@}ed.ac.uk ABSTRACT [37], which stores data persistently in a KV-store cluster, This paper presents Zidian, a middleware for key-value (KV) and answers queries in a computing cluster (as a separate stores to speed up SQL query evaluation over NoSQL. As layer) in parallel [29]. This architecture has been adopted by opposed to common practice that takes a tuple id or primary Google’s Spanner [20, 12], Facebook’s MyRocks [25], Hive [8] key as key and the entire tuple as value, Zidian proposes a and SparkSQL [11], among other systems. block-as-a-value model BaaV. BaaV represents a relation as While these systems offer the benefits of underlying KV- keyed blocks (k,B), where k is a key of a block (a set) B of storage, they do not perform as well as traditional DBMS partial tuples. We extend relational algebra to BaaV. when evaluating SQL queries, for the following reasons. We show that under BaaV, Zidian substantially reduces data (1) Costly scan. Typically, most SQL-over-NoSQL systems access and communication cost. We provide characterizations are based on a tuple-as-a-value (TaaV) model. It stores a (sufficient and necessary conditions) for (a) result-preserving relation as a set of KV pairs (k,t), in which k is an internal queries, i.e., queries covered by available BaaV stores, (b) id or primary key of a tuple t. These KV pairs are organized in scan-free queries, i.e., queries that can be evaluated without a distributed hash table (DHT). DHT supports efficient point scanning any table, and (c) bounded queries, i.e., queries access via get that given a key k, fetches the entire tuple t. that can be answered by accessing a bounded amount of data. However, for most SQL queries, we do not know the keys of We show that in parallel processing, Zidian guarantees (a) relevant tuples in advance. Hence we have to “blindly” scan no scans for scan-free queries, (b) bounded communication a table by incurring as many get’s as the size of the table. cost for bounded queries; and (c) parallel scalability, i.e., speed up when adding processors. Moreover, Zidian can be (2) Heavy communication load. As observed by [37], few plugged into existing SQL-over-NoSQL systems and retains SQL-over-NoSQL systems are able to reduce data retrieval horizontal scalability. Using benchmark and real-life data, by e.g., pushing selection predicates down to the storage we empirically verify that Zidian improves existing SQL-over- layer, and none can execute scans efficiently. As a result, NoSQL systems by 2 orders of magnitude on average. a large amount of data (even the entire relation) is often retrieved from the KV storage and is processed by the com- PVLDB Reference Format: puting layer. This incurs heavy communication cost for data Yang Cao, Wenfei Fan, Tengfei Yuan. Block as a Value for SQL shuffling in parallel execution. The situation is even worse over NoSQL. PVLDB, 12(10): 1153-1166, 2019. DOI: https://doi.org/10.14778/3339490.3339498 in the common practice of denormalizing databases [32, 36], i.e., when using wide tables or universal relations. 1. INTRODUCTION Can we reduce excessive data access and communication costs, and make existing SQL-over-NoSQL systems as effi- Key-value (KV) stores have found prevalent use in industry cient as DBMS when it comes to answering SQL queries? [22, 34, 6, 18, 7, 40]. KV stores support dictionary-like data ac- cess to retrieve and store data as key-value pairs, offering hor- Zidian. To overcome the limitations of SQL-over-NoSQL, izontal scalability, fault tolerance and transparent sharding. we develop Zidian, a middleware for KV storage. Underlying Zidian is a block-as-a-value model (BaaV). In contrast to To support queries at scale, several SQL engines have been the conventional TaaV model for KV stores, BaaV represents developed on top of KV stores. After all, 75% of business relations in KV stores as keyed blocks (k,B), where k is a data is generated and stored as relations [43], and analytics key of a block B of partial tuples. Under BaaV, arbitrary of the data is typically carried out via SQL queries. These attributes can be taken as a key k, while k can only be an systems are often based on an SQL-over-NoSQL architecture id or primary-key attributes under TaaV. Under the BaaV mode, Zidian offers the following. This work is licensed under the Creative Commons Attribution­ [1] Efficient SQL. Zidian speeds up SQL-over-NoSQL systems NonCommercial­NoDerivatives 4.0 International License. To view a copy by reducing get invocations, retrieval of irrelevant data, and of this license, visit http://creativecommons.org/licenses/by­nc­nd/4.0/. For hence both computation cost and communication cost. any use beyond those covered by this license, obtain permission by emailing [email protected]. Copyright is held by the owner/author(s). Publication rights (a) Keyed blocks offer a data locality of relations in DHT. licensed to the VLDB Endowment. With a single get, one can retrieve a block of relevant data. Proceedings of the VLDB Endowment, Vol. 12, No. 10 ISSN 2150­8097. (b) BaaV provides KV stores with convenient indexing, which, DOI: https://doi.org/10.14778/3339490.3339498 as observed by [37], is not yet well supported by KV stores. 1153 By making explicit use of indexes, we can make queries scan- (SparkSQL-over-Cassandra [6]). In addition to the framework free, to be answered without scanning any table. A scan-free of Section 5, Zidian also includes (a) a module to help design query Q fetches and operates on only the part of data needed BaaV schema under storage constraints (Section 8.1); and for answering Q, and hence also reduces computational cost. (b) adapters for deploying Zidian over existing KV systems. (c) By reasoning about keyed blocks (k,B) and the size of (6) Experiments (Section 9). Using benchmark TPC-H [42] B, we can check whether a query is bounded, which only and real-life data, we evaluate the effectiveness of Zidian. We need to access a bounded amount of data no matter how big find the following on average. (1) Zidian outperforms SoH, SoK the underlying dataset is, and hence can be answered with and SoC in efficiency by 2.8×102, 1.7×102 and 8.1×102 times bounded computation and communication costs. for scan-free queries, respectively, and by 2.0×102, 1.5×102 2 [2] Scalability. In parallel processing, Zidian guarantees (a) and 3.6×10 times for non scan-free queries. (2) With Zidian parallel scalability, i.e., speedup guaranteed when adding the systems incur stable computation and communication computing nodes to the computing layer; and (b) bounded costs for bounded queries when datasets grow. (3) Zidian is communication cost for bounded queries. Moreover, (c) Zidian parallel scalable and scales well with datasets, e.g., on average retains the horizontal scalability of SQL-over-NoSQL systems, Zidian on top of SoH takes 27.7 and 65.4 seconds for scan- free and non scan-free queries on datasets of 128GB with 8 i.e., increasing throughput when adding new nodes to the 3 3 storage layer, where the throughput is the total number of workers, respectively, compared to 1.7×10 and 2.1×10 sec- tuples retrieved from all storage nodes per second via get [37]. onds by SoH without Zidian. (4) Zidian retains the horizontal scalability of underlying KV systems for KV workload. [3] Ease of use. Zidian can be built on top of any SQL-over- We discuss related work in Section 2 and review SQL-over- NoSQL systems over any KV stores, without the need to hack NoSQL in Section 3. The proofs of the results are in [2]. into the systems or change their underlying KV storage. That is, Zidian can be “plugged into” exiting SQL-over-NoSQL systems and help speed up their SQL query answering. 2. RELATED WORK Contributions & organization. This paper proposes Zid- We categorize related work as follows. ian and justifies BaaV, from foundations to practice. SQL-over-NoSQL. The SQL-over-NoSQL architecture is (1) Data model (Section 4). We introduce BaaV, a model to widely used to support scalable parallel SQL processing over represent relations in KV stores as keyed blocks. We extend commodity machines, e.g., [34, 12, 40, 19, 35, 41, 25], capital- relational algebra to BaaV stores, to leverage the BaaV model izing on KV systems as the storage, such as Apache’s Cassan- when answering SQL queries. Moreover, we define scan-free dra [6], HBase [7] and Kudu [1]. Spanner [20, 12, 40] started queries and bounded queries in terms of BaaV query plans, this line of work, to support distributed transactions at scale. to speed up SQL evaluation on SQL-over-NoSQL systems. It is based on BigTable [18], which stores relations as tables of KV TaaV (2) A framework (Section 5). Based on BaaV, we propose pairs under . The work was followed by open-source Zidian, a framework to speed up SQL evaluation of existing systems CockroachDB [19], Nuodb [35], MyRocks [25], and SQL-over-NoSQL systems. It maps conventional databases D Partiqle [41] (supporting SPJ). SparkSQL [11] and Hive [8] SQL to BaaV stores D~ . It takes SQL queries Q posed on D and an- also provide -like query interface for Spark and Hadoop- KV KV swers Q in the corresponding BaaV store D~ whenever possible.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us