What format is data saved in? (in memory and on disk)
When does it move from memory to disk?
Why can there be only one primary key per table? (?)
How does rolling back a transaction work (?)
How are indexes formatted (?)
When and how does a full table scan work (?)
What format is a prepared statement saved in ?
sqlite has fewer features thatn MySQL or PostgreSQL so easier to code.
The entire database is stored in a single file.
[C]: lseek returns the resulting offset position of the pointer as measured in bytes from the beginning of the file.
Things you might want to do with cursors:
- Create a cursor at the beginning of the table.
- Create a cursor at end of the table
- Access the row the cursor is pointing to.
- Advance the cursor to the next one
The "front-end" of sqlite is a SQL(?) compiler that parses a string and outputs an internal representation called bytecode.
This bytecode is passed to the virtual machine, which executes it.
SQLite Architecture
B-tree | B+ tree | |
---|---|---|
Pronounced | “Bee Tree” | “Bee Plus Tree” |
Used to store | Indexes | Tables |
Internal nodes store keys | Yes | Yes |
Internal nodes store values | Yes | No |
Number of children per node | Less | More |
Internal nodes vs. leaf nodes | Same structure | Different structure |
m = tree's order ceil(m/2)<=children of each node<=m
For an order-m tree… | Internal Node | Leaf Node |
---|---|---|
Stores | keys and pointers to children | keys and values |
Number of keys | up to m-1 | as many as will fit |
Number of pointers | number of keys + 1 | none |
Number of values | none | number of keys |
Key purpose | used for routing | paired with value |
Stores values? | No | Yes |
Every leaf node has the same depth.
Each node will correspond to one page. The root node will exist in page 0. The root node will exist in page 0. Child pointers simply be the page number that contains the child node. (???)
Every node takes up exactly one page, even it's not full.
Serialization (with the usage of void pointers): The process of converting an object’s state to a byte stream. This byte stream can then be saved to a file, sent over a network, or stored in a database
Virtual machine: A memory management technique where secondary memory can be used as if it were a part of the main memory. Virtual memory is a common technique used in a computer's operating system (OS).
File Descriptor: An integer that uniquely identifies an open file of the process.
File Descriptor table: Collection of integer array indices that are file descriptors in which elements are pointers to file table entries. One unique file descriptors table is provided in the operating system for each process.
Buffer: Buffers are temporary memory used to store the input of a process that can take some time.
Buffer flush: Transfer of computer data from a temporary storage area to the computer's permanent memory. For instance if we make any changes in a file, the changes we see on a computer screen are stored temporarily in a buffer.