Click to See Complete Forum and Search --> : 2 tables or 1 big ?


patimages
09-12-2007, 01:12 PM
Hi,

I have 2 big tables (400.000 entries) and I wondered what would the fastest option: to give an easy exemple, imagine 2 tables where each row is a car model and each column some stuff about the cars (10 columns of details). Is it faster to search a car in both table and retrieve the results or to make a mega table with 20 columns?
thanks for your suggestions !

bubbisthedog
09-12-2007, 03:36 PM
I'll go out on a limb and guess that your table structure is not normalized in the first place, which could slow down a query merely on one table. Consider implementing something comparable to the following table structures instead of having a column for each detail:

CARS

car_id | car_desc
--------------------------
1 | yaris
2 | corolla

DETAILS

cad_id | cad_desc
--------------------------
1 | vinyl seats
2 | leather seats

CAR_DETAILS

crd_id | car_id | cad_id
--------------------------------------
1 | 1 | 2
2 | 1 | 1
3 | 2 | 1

patimages
09-12-2007, 04:16 PM
I see... Indeed, a newbe was caught his pants down :-D ! So, to be absolutely dumb, is it faster to separate the columns of a mega table into tables and join them while performing the query ? why ? sounds cpu consuming... Is there a way to do this using a program because with my 400.000 entries, finding all the relations betweens the entries is just impossible ! on the other hand, if allow duplicates, i can make small tables and join the row x with the raw x of other tables, right ?

I guess I need your help very much on this one guys ! thanks a lot in advance for the crash course !