lunac Posted November 11, 2006 Share Posted November 11, 2006 Ok, I'm trying to plan ahead and I can use a little advise. I'm writing an online class registration system. I have a table "student2class" which is to match students with the classes they've enrolled in, much like you might do post to categories in a blog. Anyway... Each quarter there is a new set of classes and student registering. My worry is that after awhile, this table will get large and difficult to manage. I don't really need to keep record of students2class in past sessions ( that information is tracked within the student profile), so classes can be removed once a session is over.So... what I need advise on is the best way to go about cleaning out the table. Is it better to just delete all past classes -- the id auto increments -- will that be an issue? Or is it better to create a new students2class of each session -- student2classfall06 -- then drop that table when the session is over? Or is there an even better way I haven't thought of? Link to comment https://forums.phpfreaks.com/topic/26899-db-housekeeping-best-practise/ Share on other sites More sharing options...
Nhoj Posted November 12, 2006 Share Posted November 12, 2006 [code]TRUNCATE TABLE `student2class`[/code]If you are sure you don't need the old information just run that query at the end of each session and it'l clear all of the DB contents, the rows, leaving the fields the same, and restart the auto increment ID field for you. Link to comment https://forums.phpfreaks.com/topic/26899-db-housekeeping-best-practise/#findComment-123360 Share on other sites More sharing options...
lunac Posted January 24, 2007 Author Share Posted January 24, 2007 Unfortunately, that won't work. Students register for the new session before the old one is over. If I truncate the table it will erase everything. Link to comment https://forums.phpfreaks.com/topic/26899-db-housekeeping-best-practise/#findComment-167718 Share on other sites More sharing options...
fenway Posted January 24, 2007 Share Posted January 24, 2007 Well, first, unless it gets really, really large, I wouldn't worry about it. Second, I wouldn't truncate, because then you'll have uid issues if any other tables link to this one. Third, you can always archive portions of this table, and then DELETE the non-active ones. Fourth, if you want to get really fancy, make a MERGE table of most recent two or three "tables". Link to comment https://forums.phpfreaks.com/topic/26899-db-housekeeping-best-practise/#findComment-167989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.