473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Database size optimization?

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
Nov 12 '05 #1
14 1754
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



Nov 12 '05 #2
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




Nov 12 '05 #3
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

Nov 12 '05 #4
What happens when you get two employees with the same name? It happens a
lot, and that is one of the reasons that name is not considered a good
unique id value.

Larry Linson
Microsoft Access MVP

"Mickey" <mi****@mickey.com> wrote in message
news:bv**********@ls219.htnet.hr...
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





Nov 12 '05 #5
"Mickey" <mi****@mickey.com> wrote in message news:<bv**********@ls219.htnet.hr>...
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


I agree with Peter. If you make Employee a combobox on your form,
then you can show the Employee's name instead of his ID. Properly
normalized, efficient... what's not to like?
Nov 12 '05 #6
rkc

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"Mickey" <mi****@mickey.com> wrote in message

news:<bv**********@ls219.htnet.hr>...
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


I agree with Peter. If you make Employee a combobox on your form,
then you can show the Employee's name instead of his ID. Properly
normalized, efficient... what's not to like?


Normalization is not the issue.
What can be more normalized than a table with one field?


Nov 12 '05 #7
> What happens when you get two employees with the same name? It happens a
lot, and that is one of the reasons that name is not considered a good
unique id value.


Well thing is I have made a Delphi application in which in ComboBox I select
employee name, and then write log to database.
Thing is the name can't be the same as you have to know for which name to
make
a record, so if you had EmployeeID you would also have to be able to tell
which
one you want to select so you would have to give the same named employees
index number or something like that to be able to to select the propper one.
So you could write Mark Maey, Mark Maey 1, Mark Maey 2 or something like
that.
Nov 12 '05 #8
"Roger" <le*********@natpro.com> wrote in message
news:8c**************************@posting.google.c om...
tblEmployee
employeeId autonumber (pk)
employeeName text(50)

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


Well that is the alternative what is wrong with:

tblEmployee
EmployeeName text(50)

tblEvents
EventId autonumber (pk)
StartDate Date/Time
EndDate Date/Time
EmployeeName long number (fk)

Nov 12 '05 #9
> I agree with Peter. If you make Employee a combobox on your form,
then you can show the Employee's name instead of his ID. Properly
normalized, efficient... what's not to like?


I'm not using form for data entry but my own application I made.
Nov 12 '05 #10
rkc

"rkc" <rk*@yabba.dabba.do.rochester.rr.nope> wrote in message
news:vw****************@twister.nyroc.rr.com...

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"Mickey" <mi****@mickey.com> wrote in message

news:<bv**********@ls219.htnet.hr>...
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


I agree with Peter. If you make Employee a combobox on your form,
then you can show the Employee's name instead of his ID. Properly
normalized, efficient... what's not to like?


Normalization is not the issue.
What can be more normalized than a table with one field?


Huh... never mind.

His intention to include data like John Smith 1, John Smith 2, etc in the
Employee field is definately a normalization issue.

Perhaps the hangup here is that a Delphi combox is not multi-column.
Don't know. Never used Delphi.
Nov 12 '05 #11
If you used form for record entry you would also have to be able
to distinct employees with the same name so you would also
have to have some means to do that.

"rkc" <rk*@yabba.dabba.do.rochester.rr.nope> wrote in message
news:Vs*******************@twister.nyroc.rr.com...

"rkc" <rk*@yabba.dabba.do.rochester.rr.nope> wrote in message
news:vw****************@twister.nyroc.rr.com...

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"Mickey" <mi****@mickey.com> wrote in message

news:<bv**********@ls219.htnet.hr>...
> 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

I agree with Peter. If you make Employee a combobox on your form,
then you can show the Employee's name instead of his ID. Properly
normalized, efficient... what's not to like?


Normalization is not the issue.
What can be more normalized than a table with one field?


Huh... never mind.

His intention to include data like John Smith 1, John Smith 2, etc in the
Employee field is definately a normalization issue.

Perhaps the hangup here is that a Delphi combox is not multi-column.
Don't know. Never used Delphi.

Nov 12 '05 #12
rkc

"Mickey" <mi****@mickey.com> wrote in message
news:bv**********@ls219.htnet.hr...
If you used form for record entry you would also have to be able
to distinct employees with the same name so you would also
have to have some means to do that.


How is John Smith 1 or John Smith 2 going to allow you select the correct
employee? How is the operator going to know the guy in the mail room is
John Smith 2?

Nov 12 '05 #13
> How is John Smith 1 or John Smith 2 going to allow you select the correct
employee? How is the operator going to know the guy in the mail room is
John Smith 2?


Probably more easily than if you have John Smith and John Smith.
Nov 12 '05 #14
rkc

"Mickey" <mi****@mickey.com> wrote in message
news:bv**********@ls219.htnet.hr...
How is John Smith 1 or John Smith 2 going to allow you select the correct employee? How is the operator going to know the guy in the mail room is
John Smith 2?


Probably more easily than if you have John Smith and John Smith.


If they do it will be by coincidence instead of design.

Nov 12 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ajikoe | last post by:
Hello I need to build table which need searching data which needs more power then dictionary or list in python, can anyone help me what kind of database suitable for python light and easy to learn....
8
by: Shailesh | last post by:
One problem I've been wrestling with for a long time is how to use the C++ integral data types, vis-a-vis their size. The C++ rules guarantee that a char is at least 1 bytes, a short and int at...
19
by: nospammmer | last post by:
Hello group, I have a rather general but interesting inquiry that is related to PHP and I hope this is the appropriate place to post it. I'm looking for a way to improve dramatically the...
3
by: ThazKool | last post by:
Is there anyway to write a class or struct that has no storage. It only operates on a reference to an already existing type. This is actually an extension to another thread. The thread went a...
31
by: bilbothebagginsbab5 AT freenet DOT de | last post by:
Hello, hello. So. I've read what I could find on google(groups) for this, also the faq of comp.lang.c. But still I do not understand why there is not standard method to "(...) query the...
10
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
5
by: jayapal | last post by:
Hi all, We have large code on which we are solving the bugs. For every bug we change the code part either add or delete some of the code part. More is adding the code part and very less is...
30
by: Neil | last post by:
Yikes! My database, which had been consistently 1 gig for a long time, went from being 1 gig to 3 gigs overnight! Looking at the nightly backups, the database increased on average about 5-15 MB per...
7
by: Luna Moon | last post by:
#include "stdafx.h" #include <iostream> #include <string> using namespace std; int main() { string cc(31, 'c'); string bb=cc.assign(3, 'dd');
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.