Table structure design issues
A table structure design, I don’t know how to do it, please ask:
There is a module with 6 different types of tables below, and they all have 5~6 fields in common. (Each table has more than 30 million data)
1. Create a new master table, separate these 5 fields, and add a log type ID to operate 6 tables (third normal form) and do joint queries.
<code>优点:可以方便更新共同字段、统计数据 缺点:数据多了,联合查询是个问题 </code>
2. 6 separate tables
<code>优点:(查询单表不用联合、插入也方便一些) 缺点:统计和更新共同字段状态、以及做报表什么之类的都需要 一次性去操作6个表 </code>
Which method should be better? Or any other suggestions?
Thank you!
Reply content:
A table structure design, I don’t know how to do it, please ask:
There is a module with 6 different types of tables below, and they all have 5~6 fields in common. (Each table has more than 30 million data)
1. Create a new master table, separate these 5 fields, and add a log type ID to operate 6 tables (third normal form) and do joint query.
<code>优点:可以方便更新共同字段、统计数据 缺点:数据多了,联合查询是个问题 </code>
2. 6 separate tables
<code>优点:(查询单表不用联合、插入也方便一些) 缺点:统计和更新共同字段状态、以及做报表什么之类的都需要 一次性去操作6个表 </code>
Which method should be better? Or any other suggestions?
Thank you!
When there are so many quantities
Build it in a table, and at the same time transfer the data to es. When reading, read es
update the operation table, and synchronize the updated data to es
The question is not very clear.
What is the relationship between six tables? Why does statistical update of common fields require 6 tables to be operated at one time?
What does it look like now, what is the performance, and what kind of query and update statements will there be.
In fact, if the data reaches 30 million, you can consider splitting it into tables.
Table splitting is better. When the amount of data is too large, splitting into tables is inevitable, and the splitting method is not bad. If you need to consider the need for regular retrieval, you can consider using the conditions for regular retrieval as the structure for storing split tables. , which can speed up statistics. Other methods with relatively small searches can only be searched a few times.
In view of the fact that the amount of data is in the tens of millions, you can consider regularly generating temporary statistical tables to reduce database pressure and speed up query statistics.
What scenario is the data, telecom bill? When doing business statistics, it is recommended to process it in separate tables. Sometimes it is not necessary to perform Cartesian product on a large number of tables to solve the problem

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

The built-in quantization tools on the exchange include: 1. Binance: Provides Binance Futures quantitative module, low handling fees, and supports AI-assisted transactions. 2. OKX (Ouyi): Supports multi-account management and intelligent order routing, and provides institutional-level risk control. The independent quantitative strategy platforms include: 3. 3Commas: drag-and-drop strategy generator, suitable for multi-platform hedging arbitrage. 4. Quadency: Professional-level algorithm strategy library, supporting customized risk thresholds. 5. Pionex: Built-in 16 preset strategy, low transaction fee. Vertical domain tools include: 6. Cryptohopper: cloud-based quantitative platform, supporting 150 technical indicators. 7. Bitsgap:

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.
