doujiang1001 2016-01-20 15:59
浏览 73
已采纳

拥有超过一百万个表的数据库有哪些危险? [关闭]

Can a MySql database handle over a million tables (mostly small, less than 10 rows)? I started a project that will store lots of literature, each sentence being stored in a different table consisting of about 2-10 rows. Here are some of my concerns.

  1. Will performing SELECT and INSERT queries in this database be slowed down? How much?
  2. Do website hosting services set a limit on the number of tables in a database? Or is there a universal limit for everyone?
  3. Anything else I should be concerned about?

I hope this is the right place to ask this question. Thanks.

edited:

I knew the "why" questions would come! I am crowd-sourcing translation work. My current plan is to have each sentence of a document its own table. Each row of the table will have the data for each suggested translation. For example: table "documents" will have a list of the documents being worked on. table "document_1" will be the text of one document, each row conaining one sentence. table "document_1_1" will contain each suggested translation.

I am open to hearing a better plan :)

  • 写回答

2条回答 默认 最新

  • doudai8783 2016-01-20 16:36
    关注

    No, mysql does not have a limit to number of tables in a database. Although, obviously, you will be constrained by how much disk space you have available.

    Answers:

    1. It can be very slow. Slow, that it may start hanging.

    2. I have just seen limit on number of databases, which is a marketing tactic. I don't know about the number of tables.

    3. It is generally considered a bad practice to have a database schema where the number of tables grows over time. Strongly suggest to Redesign the database.

    Instead of hundreds of thousands of tables, make just one table. Add a column containing the text that you were using to name your tables.

    From what I understood, you can have a table with these four columns:

    1. A primary key - bigint
    2. Name - text size 100, this can be your current table name (document name)
    3. Description - max text size, the data you have in table goes in this column (document text)
    4. Translation - max text size, the translation goes in this column (translated text)

    Your column two above can be non-unique and repeat as per the number of rows in the table (2-10 times).

    For more help and advice please post your questions, I know many people here are curious to know what you are cooking here.

    PS. Not a mysql person, I am sure you know what datatypes to use

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号