mySQL vertical partitioning example
I have 5 tables: "tasks, projects, customers, users, activities" and these tables have ALL the same columns : "ID, UID, title, description, createdat, createdby, updatedat ...." plus some extra columns.
I would like to regroup all the common columns in the same table so I can list easily the last updates (like the fa开发者_如何学JAVAcebook wall for instance) ...
Is it a good idea ? Should I use views in order to simulate the JOIN stuff ? How can I implement the vertical partitionning stuff in this case ?
This sounds reasonable enough a suggestion to me.
There shouldn't be any harm in implementing simple views to make querying vs. specific tables easier, e.g. (please forgive the syntax if not quite right - and by all means use column names rather then *
s!).
CREATE VIEW vw_Customers
AS
SELECT BT.*, C.*
FROM yourbasetable BT
INNER JOIN customers C
ON C.customerid = BT.ID
精彩评论