Yes, I am aware that data normalization should be my priority (as it is).
- I've got a table with 65 columns storing vehicle data with columns:
used_vehicle
,color
,doors
,mileage
,price
and so forth, in total 65. - Now, I can divide that and have a
Vehicle
table,VehicleInterior
,VehicleExterior
,VehicleTechnical
,VehicleExtra
(all one-to-one with mainVehicle
table).
Let's assume I'll have about 5 million rows (vehicles).
On SELECT
with a WHERE
clause: Will the performance be better searching through (both cases indexed at least on IDs
):
Vehicle
table with 65 columns orVehicle
table withJOINS
on four other tables (all with 5 million rows) to return all the data related toVehicle
?
(As per database engine, consider PostgreSQL and/or MySQL).
Truly appreciate any detailed insights you might have from your previous experience?
Updates will be rare if any, and selects will be mostly for all columns (vehicle details page) and main info (few columns) for search results list, and in fact maybe the best solution would be two tables: one with main info (few columns) and the other table with rest of the columns.
VehicleInterior
, other queries that deal with columns from onlyVehicleTechnical
, etc. Or if there are many rows/vehicles that have absolutely no info about (for example)VehicleExtra
so instead of many rows with lots of nulls in the one table, you have rows in the rest of the tables and no rows inVehicleExtra