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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.