RISQ DB

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which storage engine does rdb use as its underlying storage engine?

  • Oracle
  • MySQL
  • MongoDB
  • LMDB (correct)

What does rdb provide to any process running as part of a trading platform deployment?

  • A way to store data in a relational database
  • A common way to communicate with other processes
  • A way to cache data using flexible indexes (correct)
  • A way to run SQL queries

What type of data structure does LMDB use to store key-value pairs?

  • Binary tree
  • Hash table
  • Linked list
  • B+-tree (correct)

How does LMDB store values inline to the keys?

<p>Inline to the keys (A)</p> Signup and view all the answers

How many read/write transactions are allowed in LMDB at a time?

<p>Only one (A)</p> Signup and view all the answers

Which database is used as the underlying storage engine for rdb?

<p>LMDB (D)</p> Signup and view all the answers

What does rdb provide to any process running as part of a trading platform deployment?

<p>A common way to cache data (C)</p> Signup and view all the answers

What type of indexes can be built using rdb?

<p>B+-tree indexes (A)</p> Signup and view all the answers

How does LMDB ensure low latency reads and writes?

<p>By storing values inline to the keys (D)</p> Signup and view all the answers

How many read-only transactions are allowed in LMDB at a time?

<p>Multiple (C)</p> Signup and view all the answers

Which database implementation does rdb use as its underlying storage engine?

<p>LMDB (B)</p> Signup and view all the answers

How does LMDB ensure low latency reads and writes?

<p>By using a B+-tree data structure (B)</p> Signup and view all the answers

How many subdatabases does rdb use within an LMDB instance?

<p>1 (C)</p> Signup and view all the answers

Which method is used to find a record by order_id in the database?

<p>order.db_find('by_order_id', cursor) (A)</p> Signup and view all the answers

What is the purpose of the 'insert_order' function?

<p>To insert a new record into the 'order' table (C)</p> Signup and view all the answers

What does the 'update_order' function do when the record already exists in the database?

<p>Updates the record with the new values (B)</p> Signup and view all the answers

Which file is managed by the LMDB library to keep track of open transactions?

<p>Lock file (C)</p> Signup and view all the answers

What is the recommended size per key/value combination in LMDB?

<p>Less than 1KB (D)</p> Signup and view all the answers

What happens to values that exceed the maximum value size in LMDB?

<p>They are stored in overflow pages (D)</p> Signup and view all the answers

What happens to the on-disk size of the database in LMDB?

<p>It will always be larger than the size of the data stored within (C)</p> Signup and view all the answers

Match the following database terms and concepts with their descriptions:

<p>LMDB = A high-performance, transactional key-value store with a unique memory-mapped file design db_key = A subset of the fields of the db_record instance that it is the key for db_record = A value that can contain a number of fields, as well as a small header that contains some additional meta data by_rec_num = A type of db_key that is used as the primary index for all db_record’s</p> Signup and view all the answers

Match the following database best practices with their descriptions:

<p>Avoid long write transactions = To prevent locking the database for a long period of time Break write transactions into smaller units = To allow other processes to interleave writes Remove corrupted database lock file = Once the database isn’t in use Reuse nodes with no data = Using a freelist of pages</p> Signup and view all the answers

Match the following record types with their corresponding key types in rdb:

<p>order = by_timestamp</p> Signup and view all the answers

Match the following record fields with their data types in rdb:

<p>order_id = i64 client_order_id = s64 revision_number = i16 price = dbl</p> Signup and view all the answers

Match the following database operations with their corresponding SQL statements:

<p>Insert a record = INSERT INTO order (order_id, client_order_id, revision_number, price, quantity, state) VALUES ($1, $2, $3, $4, $5, $6) Update a record = INSERT INTO order (order_id, client_order_id, revision_number, price, quantity, state) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (order_id) DO UPDATE Select a record = SELECT * FROM order WHERE order_id = $1 Delete a record = Not mentioned in the text</p> Signup and view all the answers

Match the following Python functions with their corresponding database operations:

<p>find_by_order_id = Select a record insert_order = Insert a record update_order = Update a record delete_order = Delete a record</p> Signup and view all the answers

Match the following LMDB concepts with their corresponding descriptions:

<p>Database = A collection of key-value pairs Transaction = A unit of work performed on the database Cursor = An object used to read and modify the database Subdatabase = A separate, independent part of the main database</p> Signup and view all the answers

Match the following concepts from the text with their descriptions:

<p>rdb = Our proprietary record-based database that provides a common transient data storage layer and event sourcing backbone LMDB = The underlying storage engine for rdb that uses a B+-tree to store key-value pairs B+-tree = A data structure used by LMDB to store key-value pairs, with the values stored inline to the keys up to a compile-time defined size subdatabase = A feature of LMDB that allows for up to 16 databases within a single database file</p> Signup and view all the answers

Match the following LMDB features with their descriptions:

<p>Page cache = B+-trees used by LMDB are page cache friendly, resulting in low latency reads and writes without requiring additional tuning Transactions = LMDB allows for a single read/write transaction and many read-only transactions, with other potential writers blocked during a read/write transaction Database file = An LMDB instance is a single file on disk, and when a process opens the database, mmap is called to map the database file into process memory Node size = Each node of the B+-tree in LMDB is allocated at the operating system's page size, typically 4KB</p> Signup and view all the answers

Match the following rdb features with their descriptions:

<p>Common way for processes to communicate and cache data = rdb provides this using strong record definitions and flexible indexes Single subdatabase = rdb only ever uses a single subdatabase within an LMDB instance Compile-time defined size = LMDB stores values inline to the keys up to this size Page cache leverage = LMDB's node size matching the page size allows it to leverage the page cache to its full potential</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Use Quizgecko on...
Browser
Browser