关于数据库中的空字段 [英] About empty field in database

查看:113
本文介绍了关于数据库中的空字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队,



我有一个表,其中包含的数据库字段为空。我只是想知道这个 -

1-它是否会对数据库性能产生任何影响。

2-它占据了数据库中的任何空间。

请指导我。



谢谢

Ravik

Hi Team,

I have a Table, which is contain number of database field are Empty. I just want to be know about that-
1- Is it make any impact on database performance.
2- It it occupied any Spaces in data base.
Please guide me.

Thanks
Ravik

推荐答案

在设计数据库时,必须设置每列的大小,以避免在插入时不必要地分配内存和数据库大小记录。



你说有些列可能有空值,你无法避免,因为你不能为每个行值设计一个表,而是你设计列。



例如:如果你已经设置了varchar大小为30的MyPhone列,无论你存储了多少数据,无论它是一个char还是10个char或30个空间分配是30.如果你试图存储超过它,它将你的数据裁剪为30个字符长度。



所以在这种情况下你不能做任何更好的事情options必须将列大小限制为所需的长度,而不是设置一些任意数字。是的空格会增加数据库大小,因此在设计数据库表时必须小心。
While designing a database you must set the size of the each column to avoid any unnecessary allocation of memory and database size while inserting a record.

You said some of the columns may have empty values which you cannot avoid because you cannot design a table for each row value, rather you design column wise.

for eg: if you have set the MyPhone column with varchar size 30 no matter how much data you stored whether it''s one char or 10 char or 30 the space allocation is 30. and if you try to store more than that it will crop your data to 30 char length.

so in this case you cannot do anything the better options must be limit the column size to the required length rather setting some arbitrary number. and Yes empty space increases your database size so care must be take while designing your database tables.


这篇关于关于数据库中的空字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆