作者 主題: 請問mysql一個database下最多支援幾張table  (閱讀 5519 次)

0 會員 與 1 訪客 正在閱讀本文。

treble

  • 活潑的大學生
  • ***
  • 文章數: 215
    • 檢視個人資料
    • 牛的大腦
各位先進好

小弟最近在開發一套程式,目前打算在mysql的一個database底下建立多張table
但為了保險起見,想先確認一下mysql的一個database是否有限制table的數量呢?
我可能會建到幾千個table

系統是centos5,mysql5
感謝
[牛的大腦  http://systw.net ] 用來放一些筆記資料
[單字我朋友  http://systw.net/word ] 練英文用的
2分鐘檢測你的單字能力 http://systw.net/word/q.php

Darkhero

  • 酷!學園 學長們
  • 俺是博士!
  • *****
  • 文章數: 3728
  • 性別: 男
    • 檢視個人資料
    • ㄚ凱隨手紀
http://www.dbforums.com/mysql/378480-max-number-tables-mysql-database.html

引用
When using MyISAM table, the limit will be determined by your operating system, ie. the number of files you can have in one directory.

Using InnoDB tables removes that limitation by allowing multiple tables within a single datafile (tablespace).

The maximum tablespace size is 4 billion database pages. By default, a 'page' is 16K, but it is possible to recompile with 64K pages. This will allow a single tablespace size of ... 'BIG'.

A table will obviously take up at least one database page, meaning you can theoretically have a maximum of 4 billion tables per tablespace.

The number of tablespaces will again be limited by your operating system. Using NTFS on NT, the limit is 4,294,967,295. I imagine UNIX will be limited by the number of inodes. However, before reaching the physical limit of files you wil probably run into an issue with the maximum number of 'open' files allowed.

The first limit you hit will undoubtedly be that of your wallet while buying disk drives.

用 MyISAM 的話, 應該是可以有非常多個...
真正需要考慮的或許是單檔大小的問題...

另外要是用 innodb 的話, 也有 innodb.data file 大小的問題....
希望我們的討論是為了把問題解決,而不是爭論誰對誰錯.
『灌水才是重點,發文只是順便』
『我寧可讓不會釣魚的工程師餓死,也不想讓會餓死的工程師去攪沉公司....』
Blog: http://blog.darkhero.net/
秘密基地: http://www.darkhero.net/comic/
目前服務的網站: http://www.libook.com.tw/

treble

  • 活潑的大學生
  • ***
  • 文章數: 215
    • 檢視個人資料
    • 牛的大腦
了解了,所以最主要還是要考檔案系統可放多少檔案
那這樣我就可以放心的給他做下去了

其實主要是資料都放在一個table太大了,10幾g,每次select都要好久
建索引,調my.cnf效果都有限
但分成多張table,在各別select後在merge,速度竟然快很多
所以才想說把一張table打散成多張table

感謝啦
[牛的大腦  http://systw.net ] 用來放一些筆記資料
[單字我朋友  http://systw.net/word ] 練英文用的
2分鐘檢測你的單字能力 http://systw.net/word/q.php