Connecting Tech Pros Worldwide Help | Site Map

Which one is best ?

  #1  
Old July 17th, 2005, 03:29 AM
Marco
Guest
 
Posts: n/a
Currently I have 3 mysql tables with about 6 columns each, sometimes I have
to access to all of them at the same time but most of the times I access 2
at the same time.

I was wondering which is fast making a single table with about 18 columns,
and each time select the columns that I want in the select query, this way I
would do less select queries.
Or is it better like I have 3 tables, and access 2 of them at the same time
most of the times?

Probably I should post this in a MySQL news server, anyway if someone has
some thoughts about it don't be shy ;)

Thx
Marco


  #2  
Old July 17th, 2005, 03:29 AM
Aggro
Guest
 
Posts: n/a

re: Which one is best ?


Marco wrote:
[color=blue]
> I was wondering which is fast making a single table with about 18 columns,
> and each time select the columns that I want in the select query, this way I
> would do less select queries.
> Or is it better like I have 3 tables, and access 2 of them at the same time
> most of the times?[/color]

There is no simple yes or no answer to it, it depends much about what
kind of queries you need to make and how many rows you are supposed to
have in each table.

For example:
If you have 100 000 rows in all tables, and all rows are linked 1 and
only 1 row in other tables, you propably would be better putting all in
one table.

Then again, if you have table with 100 000 rows and another table with
about 10 rows, and each row has a string that you want to do a query
like: select * from nametable where name like '%middletext%';

It would be faster to use different tables. Because if you would have 1
table, you would have to search all rows in it, because you couldn't
benefit from indexes. But when using two tables, you would find the
names by searching 10 rows and then you could use name_id in your larger
talbe, which would be of course indexed.

These are only two examples, but I hope you understant what I'm trying
to say: There is no simple answer to this question.
  #3  
Old July 17th, 2005, 03:29 AM
Dasher
Guest
 
Posts: n/a

re: Which one is best ?


MySQL is a relational database it is designed to be fast with multiple table
accesses. I have queries that access 5 tables at once. It is still fast.

If you can do the query in a simple wide table... you really don't need a
relational database.



"Marco" <mpgtlatbluewindotch> wrote in message
news:4009341e$1_1@news.bluewin.ch...[color=blue]
> Currently I have 3 mysql tables with about 6 columns each, sometimes I[/color]
have[color=blue]
> to access to all of them at the same time but most of the times I access 2
> at the same time.
>
> I was wondering which is fast making a single table with about 18 columns,
> and each time select the columns that I want in the select query, this way[/color]
I[color=blue]
> would do less select queries.
> Or is it better like I have 3 tables, and access 2 of them at the same[/color]
time[color=blue]
> most of the times?
>
> Probably I should post this in a MySQL news server, anyway if someone has
> some thoughts about it don't be shy ;)
>
> Thx
> Marco
>
>[/color]


  #4  
Old July 17th, 2005, 03:29 AM
Dan Tripp
Guest
 
Posts: n/a

re: Which one is best ?


Marco wrote:[color=blue]
> Currently I have 3 mysql tables with about 6 columns each, sometimes I have
> to access to all of them at the same time but most of the times I access 2
> at the same time.
>
> I was wondering which is fast making a single table with about 18 columns,
> and each time select the columns that I want in the select query, this way I
> would do less select queries.
> Or is it better like I have 3 tables, and access 2 of them at the same time
> most of the times?
>
> Probably I should post this in a MySQL news server, anyway if someone has
> some thoughts about it don't be shy ;)
>
> Thx
> Marco
>
>[/color]

I've always leaned toward implementing a more highly normalized (more
granularized) form. The DB developers I've worked with all lean towards
this approach as well.

In the past I've seen how easily I could have "shot myself in the foot"
if I hadn't normalized. Here are some links to articles I thought were
pretty decent:
http://www.serverwatch.com/tutorials...le.php/1549781
http://www.sqlmag.com/Articles/Index...leID=4887&pg=1

http://www.devshed.com/c/a/MySQL/An-...Normalization/

Regards,

- Dan
http://www.dantripp.com/
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which one is best tkinter or wx python? sudhakaranr answers 1 December 22nd, 2006 06:53 AM
Which one is best? ram_palavalasa answers 3 April 21st, 2006 03:35 PM
Which one is best performance? Khaled Atta answers 2 November 16th, 2005 01:49 AM
Which one is best performance? Khaled Atta answers 2 November 16th, 2005 01:17 AM
Which one is best performance? Khaled Atta answers 2 November 16th, 2005 12:46 AM