Question about joins and table with Millions of rows
Posted
by xRobot
on Stack Overflow
See other posts from Stack Overflow
or by xRobot
Published on 2010-05-01T19:36:43Z
Indexed on
2010/05/01
19:47 UTC
Read the original article
Hit count: 267
I have to create 2 tables:
Magazine ( 10 millions of rows with these columns: id, title, genres, printing, price )
Author ( 180 millions of rows with these columns: id, name, magazine_id )
. Every author can write on ONLY ONE magazine and every magazine has more authors.
So if I want to know all authors of Motors Magazine, I have to use this query:
SELECT * FROM Author, Magazine WHERE ( Author.id = Magazine.id ) AND ( genres = 'Motors' )
The same applies to Printing and Price column.
To avoid these joins with tables of millions of rows, I thought to use this tables:
Magazine ( 10 millions of rows with this column: id, title, genres, printing, price )
Author ( 180 millions of rows with this column: id, name, magazine_id, genres, printing, price )
. and this query:
SELECT * FROM Author WHERE genres = 'Motors'
Is it a good approach ?
I can use Postgresql or Mysql.
© Stack Overflow or respective owner