Pre-flight Checklist
Primary Contact Name
Nikša Skeledžija
Primary Contact Email
niksa.skeledzija@oracle.com
Company / Organization
Oracle
Role
Software Engineer
Additional Authors / Contributors
Annamalai Gurusami annamalai.gurusami@oracle.com
Component
InnoDB
Target Release (Optional)
No response
Roadmap Section
Performance & Observability
Related Issues / Pull Requests / References (Optional)
No response
Executive Summary
Ingesting a lot of raw data from CSV files becomes very slow in certain cases. Regular LOAD DATA statement in mysql boils down to a bunch of INSERTs in the background, which means we do a lot of tree traversals, page allocation just in time, and various other side effects of managing the B+tree inside InnoDB. In some cases, such as when ingesting unsorted data in the range of TBs where the data size exceeds the buffer pool size, we basically grind to a halt and it is not feasible to load such data into the DB. To allow such a use case, we will implement a bulk load algorithm which will deal with this exact scenario where we know up-front that a lot of data is coming in. We can then pre-allocate the extents involved, we can take table level locks up-front, we can sort the data before loading in case the input is unsorted to avoid random page access. We can also leverage the parallel index build infrastructure to build multiple separate sub-trees concurrently and merge them at a later phase by adding a root page.
User / Developer Stories
- As a developer using mysql, I would like to be able to ingest data coming from various non-mysql sources in CSV files quickly into my database.
- As a developer using a multi-core machine, I would like mysql to be able to consume as much of my system's resources (cpu cores, RAM) as I specify so it can maximize the ingestion throughput.
Proposed Scope
- Implement the bulk load functionality which is available by using LOAD DATA ... ALGORITHM=BULK.
Out of Scope / Future Work
- Non-empty tables require a merge with old data phase, which in some worst case scenarios reduces the performance of bulk load.
- Partitioned tables require the CSV file distribution per partition to be known up-front and given to bulk loader via the PARTITIONS clause in the LOAD DATA statement.
References
No response
Functional Requirements
No response
Non-functional Requirements
No response
Impact Areas
Summary of the Approach
No response
User Interface
No response
Configuration / Knobs
No response
Observability
No response
User Procedure
No response
Security Considerations
No response
Compatibility and Behavior Changes
No response
Block Diagram
No response
Interface Specification
No response
Proposed Implementation Plan
No response
QA Notes
No response
Pre-flight Checklist
Primary Contact Name
Nikša Skeledžija
Primary Contact Email
niksa.skeledzija@oracle.com
Company / Organization
Oracle
Role
Software Engineer
Additional Authors / Contributors
Annamalai Gurusami annamalai.gurusami@oracle.com
Component
InnoDB
Target Release (Optional)
No response
Roadmap Section
Performance & Observability
Related Issues / Pull Requests / References (Optional)
No response
Executive Summary
Ingesting a lot of raw data from CSV files becomes very slow in certain cases. Regular LOAD DATA statement in mysql boils down to a bunch of INSERTs in the background, which means we do a lot of tree traversals, page allocation just in time, and various other side effects of managing the B+tree inside InnoDB. In some cases, such as when ingesting unsorted data in the range of TBs where the data size exceeds the buffer pool size, we basically grind to a halt and it is not feasible to load such data into the DB. To allow such a use case, we will implement a bulk load algorithm which will deal with this exact scenario where we know up-front that a lot of data is coming in. We can then pre-allocate the extents involved, we can take table level locks up-front, we can sort the data before loading in case the input is unsorted to avoid random page access. We can also leverage the parallel index build infrastructure to build multiple separate sub-trees concurrently and merge them at a later phase by adding a root page.
User / Developer Stories
Proposed Scope
Out of Scope / Future Work
References
No response
Functional Requirements
No response
Non-functional Requirements
No response
Impact Areas
Summary of the Approach
No response
User Interface
No response
Configuration / Knobs
No response
Observability
No response
User Procedure
No response
Security Considerations
No response
Compatibility and Behavior Changes
No response
Block Diagram
No response
Interface Specification
No response
Proposed Implementation Plan
No response
QA Notes
No response