简体   繁体   English

糟糕的数据库设计 - 我的桌子太大了吗?

[英]Bad Database Design - Is my table too large?

I have a poorly designed database. 我有一个设计糟糕的数据库。 One of the most important tables has 11,000+ entries. 其中一个最重要的表有11,000多个条目。 We would like to expand our system, and I am wondering if this table grew to 5x its size, would this be a problem? 我们想扩展我们的系统,我想知道这个表是否增长到它的大小的5倍,这会是一个问题吗? It's 15360 kB in size... if that matters. 它的大小为15360 kB ......如果重要的话。


I'm using phpMyAdmin, the server is a Fedora Linux box (nothing fancy), The load is light. 我正在使用phpMyAdmin,服务器是一个Fedora Linux盒子(没什么特别的),负载很轻。 It stores just about everything our system uses. 它存储了我们系统使用的所有内容。

What DBMS? 什么DBMS? What server? 什么服务器? What load? 什么负载? What application? 什么应用?

Besides: 11.000 records are nothing, really. 此外:11.000记录什么都没有,真的。 Even in MS Access. 甚至在MS Access中。 :-) :-)

EDIT: So I assume you use a fairly recent MySQL with MyISAM tables. 编辑:所以我假设你使用一个相当新的MySQL与MyISAM表。 In theory, you can go ahead and fill the table into the millions of records. 从理论上讲,您可以继续将表格填入数百万条记录中。 Depending on how you work with them (lots of joins / or not, lots of queries/updates/deletes / or not), you don't need to do anything special. 根据您使用它们的方式(很多连接/不连接,很多查询/更新/删除/不),您不需要做任何特殊的事情。 Put a proper index on the table and you should be fine. 在桌子上放一个适当的索引,你应该没事。

I understand that you are worried if increasing the number of records to around 55.000 in"your poorly designed database" will affect performance. 我知道您担心在“设计不佳的数据库”中将记录数增加到55.000左右会影响性能。

If you system works as expected now I think you should be fine with 50.000 records as well unless you have some slight performance issues already. 如果您的系统按预期工作,我认为除非您有一些轻微的性能问题,否则您应该可以使用50.000记录。

As most people mentioned 50k records is a very small number in relation to database table size and even with not normalized database there should be no performance issues. 正如大多数人所提到的,50k记录与数据库表大小相关的数量非常少,即使没有规范化的数据库,也不会出现性能问题。

If you are planning to expand the functionality of you system then perhaps it would be a good time to look at the database design as well, otherwise it should be reasonably safe to leave it as it is. 如果您计划扩展系统的功能,那么也许现在也是查看数据库设计的好时机,否则保持原样应该是合理安全的。

I don't think you're providing enough information for someone to give an answer. 我认为你没有提供足够的信息给某人给出答案。 Why is it poorly designed? 为什么设计不合理? Is it not normalized? 它没有正常化吗? Do you not have any indexes? 你没有任何索引吗? What DB is it? 这是什么数据库? What OS is it running on? 它运行的操作系统是什么? How long does it take now to query a record from the table in question? 现在查询相关表中的记录需要多长时间?

11k entries is not that many. 11k条目并不多。 50K is not large either. 50K也不大。

Putting indexes on the table (optimized for the queries you will run on it) will allow good performance for much larger amounts than what you are envisioning. 将索引放在表格上(针对您将在其上运行的查询进行了优化)将允许比您想象的更大的数量的良好性能。

If the design is poor enough though, you might look into the cost of redesigning. 如果设计足够差,你可能会考虑重新设计的成本。

What do you mean by a "poorly designed database"? “设计不佳的数据库”是什么意思?

If it's badly designed, redesign it, drag the information out fo the current tables, and populate the new one. 如果它的设计很糟糕,重新设计它,将信息拖出当前表格,然后填充新表格。

If you're concerned about performance, 11000 entries is not big. 如果你担心性能,11000个条目并不大。 A 15 megabyte database is extremely small, by db standards. 按db标准,15兆字节的数据库非常小。

The size of a table isn't very important. 表的大小不是很重要。 The design of the key, indexes, and relationships have much much more to do with the quality of the design than does the size of the data contained in it. 密钥,索引和关系的设计与设计质量的关系远远大于其中包含的数据的大小。 There are obviously caveats to this; 这显然有一些警告; but optimizing the size of a table is near the last thing I do when working on a performance or design problem. 但是在处理性能或设计问题时,优化表的大小是我做的最后一件事。

You may want to explain more about why you think this is a poorly designed database and what things you can (easily) do to correct the issues. 您可能想要更多地解释为什么您认为这是一个设计不佳的数据库,以及您可以(轻松)做些什么来纠正问题。 Along with that you should detail the type of DBMS and what the usage is (web app, custom app, reporting, etc). 除此之外,您还应详细说明DBMS的类型以及用途(Web应用程序,自定义应用程序,报告等)。

15MB is nothing. 15MB没什么。 11k rows as well. 11k行也是如此。 I have databases with 2+ GB of data, with some tables containing over 1 million rows and I consider that being somewhere between small and medium size. 我有2 GB以上的数据库,有些表包含超过100万行,我认为它介于中小尺寸之间。

You really didn't give any evidence to support your claim that this is a poorly designed database. 你真的没有提供任何证据支持你声称这是一个设计糟糕的数据库。 What makes it poorly designed? 是什么让它设计不佳? does the table have 876 columns? 该表有876列吗? Are the columns named Col1, Col2, Col3...? 列是Col1,Col2,Col3 ......? Does it use a float and a datetime as a composite primary key? 它是否使用float和datetime作为复合主键? It is poorly normalized? 它很难正常化? The only thing we know about is it's record count. 我们唯一知道的是它的记录数。

11K records is usually nothing in database terms. 在数据库方面,11K记录通常没什么。

What else makes you think the database is poorly designed apart from the number of records in the one table? 除了一个表中的记录数之外,还有什么能让您认为数据库的设计很差?

You need to give a lot more information about the table structure. 您需要提供有关表结构的更多信息。

In general, 15,000 rows in a table would be considered small, in fact so small, that some designers might not even bother with indexing it. 一般来说,表中的15,000行会被认为很小,实际上很小,以至于某些设计人员甚至可能不会为索引编制索引。

If you are going to expand your system, now is the time to redesign if need be. 如果您要扩展系统,现在是时候重新设计了。 It is much less painful to redesign when you have 11,000 records than when you have 10 million. 当你拥有11,000条记录而不是1000万条记录时,重新设计的痛苦要小得多。 However, nothing you have said indicates to me that you need to redesign. 但是,你所说的没有告诉我你需要重新设计。 There is nothing inherently wrong with having joins (in fact a well designed database should have them). 有连接没有任何固有的错误(事实上,一个设计良好的数据库应该有它们)。 Post some details about the struture and we can help you decide if redesign is needed. 发布关于结构的一些细节,我们可以帮助您决定是否需要重新设计。

It is possible that the problem is that you and your colleagues are simply not experienced at database access and do not know how to effectively and easily query them. 可能的问题是您和您的同事根本没有数据库访问经验,也不知道如何有效和轻松地查询它们。 Or the problem could be that the design is bad, without details of the structure, it is hard to say. 或者问题可能是设计不好,没有结构细节,很难说。

A bad foundation will be your most costly mistake. 糟糕的基础将是你最昂贵的错误。 If the table is important, then you need to decide how important it is to fix it. 如果表格很重要,那么您需要决定修复它的重要性。 The amount of rows in a table only affects the speed at which you can pull stuff out of it. 表中的行数仅影响从中提取内容的速度。 But, if you've got a bad database design to start with, your hands will be tied at certain places down the road. 但是,如果你的数据库设计开始不好,那么你的双手将会被困在某些地方。

If you are talking about SQL Server 2005, look into SQL Server profiler and use Index Tuning wizard. 如果您正在谈论SQL Server 2005,请查看SQL Server概要分析器并使用“索引优化”向导。

There is also support in some databases for table pinning to memory if you want additional performance. 如果您想要额外的性能,还可以在某些数据库中支持将表固定到内存。

What a record is comprised of can matter more than how many records are in a table. 记录的组成比表中的记录多得多。

Where I work we have databases with numerous tables having record counts in the tens of thousands or hundreds of thousands. 在我工作的地方,我们拥有数据库,其中有许多表,其记录数量达数万或数十万。 Our databases are considered small, for the most part. 我们的数据库在很大程度上被认为很小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM