数据库大小优化? [英] Database size optimization?

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

问题描述

我有一个数据库,其中我有2个表。

一个表是Employees,另一个是Events。


我在Employees中只有一个字段它是EmployeeName(文本50个字符)。

事件包含字段自动编号,开始日期/时间,结束日期/时间,员工姓名。

我有员工关系员工姓名1对于许多活动。


我的问题是:


事件表中的每条记录都占用了EmployeeName的空间,还是编码为

在数据库中以另一种方式,所以它不占用EmployeeName的大小?


我如何组织我的数据库,以便它将使用最少的空间每

记录?


Thanx

解决方案

Mickey先前写道:
< blockquote class =post_quotes>我有一个数据库,其中有2个表。
一个表是Employees,另一个是Events。

我在Employees中只有一个字段,它是EmployeeName (文字50 <事件有字段自动编号,开始日期/时间,结束日期/时间,
员工姓名。
我有员工姓名,从员工1到很多事件。

我的问题是:

事件表中的每条记录都占用了EmployeeName的空间,还是以其他方式在数据库中编码
因此它不占用大小EmployeeName?


这个名字将保存在每条记录中。


您可以代替员工,但这意味着修改

员工表添加一个id字段,然后对事件表进行一些更新,将事件表改为基于id的字段。


如何我是否必须组织我的数据库,以便每个记录使用最少的空间?




空间没关系,除非你有更多的话,

文件中的100,000名员工。


然而,最好将Events表更改为包含id

而不是名称。人们的姓名确实会发生变化,而且id字段会启用

名称要更改并显示在数据库的任何位置。


对于Employees表,你需要添加一个自动编号字段作为主要的

键字段。

所以你需要:

EmpID自动编号(PK)

EmployeeName文本50

要更改Events表,首先需要创建一个临时表

tempEvents,其中包含EmployeeName和Empid。


创建一个maketable查询,它使用两个当前表,链接在

EmployeeName上。添加Events表中的所有字段和Empid字段

来自Employees表。

运行此查询并检查表中的一些示例值以确保

表示正确的ID与每个名称相关联。


将旧事件表重命名为OldEvents。

将tempEvents重命名为Events。 />
从新事件表中删除员工姓名字段。

(您可能必须先删除并重新创建两个

表之间的关系 - 现在基于EmpId)


要显示没有名字的事件列表,那么你只需查看事件

表。

要显示包含名称的事件列表,您必须基于

两个表创建一个查询,包括Employees表中的名称。


回到这里发生任何问题。


问候


Peter Russell




感谢您的评论。

但是,如果尺寸不是问题,但记录数量是那么我宁愿

保留名称,因为它们可以轻松控制事件,

你不要如果你必须手动更改

,我们必须解码EmployeeID。


祝你好运,米奇


Peter Russell < RU *** @ 127.0.0.1>在消息中写道

新闻:我********************** @ russellscott.btinter net.com ...

Mickey先前写道:

我有一个数据库,其中有2个表。
一个表是Employees,另一个是Events。
字符)。
事件包含字段自动编号,开始日期/时间,结束日期/时间,
员工姓名。 />我有EmployeeName从Employees 1到很多事件的关系。

我的问题是:

事件表中的每条记录都占用EmployeeName的空间还是
在数据库中以另一种方式编码
因此它不占用EmployeeName的大小?



名称将保存在每条记录中。

你可以保留一个employeeid,但这意味着修改
Employees表以添加一个id字段,然后对事件表进行一些更新以更改为id基于字段。

我如何组织我的数据库,以便每个记录使用最少的空间?


<除非你有超过100,000名员工在
文件上,否则空间无关紧要。

然而,最好将Events表更改为包含id
而不是名字。人们的名字确实会发生变化,而id字段会使名称在数据库中随处可见。

对于Employees表,您需要添加一个Autonumber字段作为初级
关键领域。
所以你会有:
EmpID自动编号(PK)
员工姓名文本50

要更改事件表,首先需要创建一个包含EmployeeName和Empid的临时表
tempEvents。

创建一个maketable查询,该查询使用两个当前表,链接在EmployeeName上。从Employees表中添加Events表和Empid字段中的所有字段。
运行此查询并检查表中的一些示例值,以确保
正确的ID已与每个名称。

将旧事件表重命名为OldEvents。
将tempEvents重命名为Events。
从新事件表中删除Employee name字段。
(你可能必须首先删除并重新创建两个
表之间的关系 - 现在基于EmpId)

要显示没有名称的事件列表,那么你只需看一下事件
表。
要显示带有名称的事件列表,您必须根据两个表创建一个查询,包括Employees表中的名称。

出现的问题。

问候

Peter Russell




tblEmployee

employeeId autonumber(pk)

employeeName text(50)


tblEvents

eventId autonumber(pk)

employeeId long number(fk)

startDate dateTime

endDate dateTime


" Mickey" < MI **** @ mickey.com>在消息新闻中写道:< bv ********** @ ls219.htnet.hr> ...

我有一个数据库,其中有2个表。
一个表是Employees,另一个是Events。

我在Employees中只有一个字段,它是EmployeeName(文本50个字符)。
事件有字段AutoNumber,Start Date / Time,End日期/时间,员工姓名。
我有员工名称,从员工1到多人参加活动。

我的问题是:

事件表中的每条记录都占用空间对于EmployeeName,还是以其他方式在数据库中进行编码,因此它不占用EmployeeName的大小?

我如何组织我的数据库,以便每个记录?

Thanx



I have a database in which I have 2 tables.
One table is Employees, other is Events.

I have only one field in Employees and it is EmployeeName (text 50 chars).
Events has fields AutoNumber, Start Date/Time, End Date/Time, EmployeeName.
I have relationships EmployeeName from Employees 1 to many for Events.

My question is:

Does every record in Events table take space for EmployeeName or is it coded
in database in another way so it doesnt take up size of EmployeeName?

How would I have to organize my database so it would use the least space per
record?

Thanx

解决方案

Mickey previously wrote:

I have a database in which I have 2 tables.
One table is Employees, other is Events.

I have only one field in Employees and it is EmployeeName (text 50
chars).
Events has fields AutoNumber, Start Date/Time, End Date/Time,
EmployeeName.
I have relationships EmployeeName from Employees 1 to many for Events.

My question is:

Does every record in Events table take space for EmployeeName or is it
coded
in database in another way so it doesnt take up size of EmployeeName?
The name will be held in every record.

You could hold an employeeid instead but it would mean modifying the
Employees table to add an id field and then doing a couple of updates on
the Events table to change to an id based field.

How would I have to organize my database so it would use the least
space per record?



Space doesn''t matter unless you have more than say, 100,000 employees on
file.

However it would be better to change the Events table to contain an id
rather than a name. People''s names do change and an id field would enable
the name to be changed and shown everywhere in the database.

For the Employees table you need to add an Autonumber field as a primary
key field.
So you would have:
EmpID Autonumber (PK)
EmployeeName Text 50

To change the Events table you first need to create a temporary table
tempEvents which contains both the EmployeeName and the Empid.

Create a maketable query which uses both current tables, linked on
EmployeeName. Add all fields from the Events table and the Empid field
from the Employees table.
Run this query and check some sample values from the table to make sure
that the correct ID has been associated with each name.

Rename the old events table as OldEvents.
Rename tempEvents to Events.
Delete the Employee name field from the new Events table.
(You might have to delete and re-create relationships between the two
table first - now based on EmpId)

To show a list of events without names then you just look at the Events
table.
To show a list of events WITH names then you must create a query based on
both tables, including the name from the Employees table.

Post back here with any issues arising.

Regards

Peter Russell




Thanks on comments.
But, if size is not an issue but number of record is then I will rather
keep the names because they enable easy control over events,
you don''t have to decode EmployeeID if you have to change
something manualy.

Best regards, Mickey

"Peter Russell" <ru***@127.0.0.1> wrote in message
news:me**********************@russellscott.btinter net.com...

Mickey previously wrote:

I have a database in which I have 2 tables.
One table is Employees, other is Events.

I have only one field in Employees and it is EmployeeName (text 50
chars).
Events has fields AutoNumber, Start Date/Time, End Date/Time,
EmployeeName.
I have relationships EmployeeName from Employees 1 to many for Events.

My question is:

Does every record in Events table take space for EmployeeName or is it
coded
in database in another way so it doesnt take up size of EmployeeName?



The name will be held in every record.

You could hold an employeeid instead but it would mean modifying the
Employees table to add an id field and then doing a couple of updates on
the Events table to change to an id based field.

How would I have to organize my database so it would use the least
space per record?



Space doesn''t matter unless you have more than say, 100,000 employees on
file.

However it would be better to change the Events table to contain an id
rather than a name. People''s names do change and an id field would enable
the name to be changed and shown everywhere in the database.

For the Employees table you need to add an Autonumber field as a primary
key field.
So you would have:
EmpID Autonumber (PK)
EmployeeName Text 50

To change the Events table you first need to create a temporary table
tempEvents which contains both the EmployeeName and the Empid.

Create a maketable query which uses both current tables, linked on
EmployeeName. Add all fields from the Events table and the Empid field
from the Employees table.
Run this query and check some sample values from the table to make sure
that the correct ID has been associated with each name.

Rename the old events table as OldEvents.
Rename tempEvents to Events.
Delete the Employee name field from the new Events table.
(You might have to delete and re-create relationships between the two
table first - now based on EmpId)

To show a list of events without names then you just look at the Events
table.
To show a list of events WITH names then you must create a query based on
both tables, including the name from the Employees table.

Post back here with any issues arising.

Regards

Peter Russell





tblEmployee
employeeId autonumber (pk)
employeeName text(50)

tblEvents
eventId autonumber (pk)
employeeId long number (fk)
startDate dateTime
endDate dateTime

"Mickey" <mi****@mickey.com> wrote in message news:<bv**********@ls219.htnet.hr>...

I have a database in which I have 2 tables.
One table is Employees, other is Events.

I have only one field in Employees and it is EmployeeName (text 50 chars).
Events has fields AutoNumber, Start Date/Time, End Date/Time, EmployeeName.
I have relationships EmployeeName from Employees 1 to many for Events.

My question is:

Does every record in Events table take space for EmployeeName or is it coded
in database in another way so it doesnt take up size of EmployeeName?

How would I have to organize my database so it would use the least space per
record?

Thanx



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

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