Python implements simple database (i) storage and index creation

Source: Internet
Author: User
Tags implement

Nothing recently. Do a database project, requires the implementation of a simple database, to meet a number of specific queries, here is the main introduction of our implementation process, the code in the Ithub, can be seen here. It is said that Python is running slowly, but because of the time and the workload, we have chosen to implement Python efficiently.

First, the basic requirements

1, Design storage mode

The measured data size is 1.5GB, and the largest table has 6,001,215 records. Minimize the number of I/O, reduce disk occupancy space.

2. Implement and optimize group By,order by

Group by aggregation and sequencing of large tables to improve query efficiency

3, implementation and optimization of top K

High efficiency to achieve top K

4. No requirement for insert

Second, the overall design

Because the request is mainly to optimize the query, insert deletion is not considered, can be used in the column-type database, play the advantages of the column-type database.

The following are the main frameworks (ignoring the process of building and inserting data), the blue arrows in the figure indicate the generation stream, and the orange arrow indicates the execution stream.

The whole process is in fact the first to build the index, from the bottom to execute the query, details in the detailed design of the story.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.