Tuesday, 15 January 2013

php - SQL Table Structure for news site -



php - SQL Table Structure for news site -

i want create fast table construction news site php , mysql. database construction id, title, content, cat_ids (; separedet ids of categories - ;5;10;15;20;), active, publish_date.

i want create fast query select news table. that:

select id news cat_ids '%;15;%' , active = 1 , publish_date < now() order publish_date desc limit 0, 10

but if table 2-3gb query slow. need ideas create construction , create select faster.

instead of using cat_ids column, seek creating news_cats table news_id , cat_id, , using query:

select id news bring together news_cats on news_id = id cat_id = 15 , active = 1 , publish_date < now() order publish_date desc limit 0, 10

php mysql database

No comments:

Post a Comment