Print Topic - Archive

E-Blah Community  /  E-Blah Bugs  /  General Question
Posted by: vol7ron, April 17, 2008, 9:38am
Not sure if this is how things are done in the flat file database (Eblah 10.3.5).

In the SQL version when the last post of a thread is deleted, the thread is deleted but the post still remains in the post table.  Was wondering if this was on purpose or a design flaw.

Thanks,
vol7ron
Posted by: vol7ron, April 17, 2008, 10:44am; Reply: 1
Didn't know if you wanted to change the program or provide a clean up utility, but this will delete all the occasions

Code
DELETE FROM ${main::forumprefix}POSTS 
WHERE ID IN(
   select id from ${main::forumprefix}posts 
   where not exists (
      select * from ${main::forumprefix}topics 
      where ${main::forumprefix}posts.threadid = ${main::forumprefix}topics.id
   )
);


There may or may not be a more efficient query to do the same thing.  But it pretty much goes through and deletes all the posts that don't have a thread anymore.

Because the forecasted threads that get deleted with remaining posts is probably gonna be a small number, you'd probably wanna save processing power for the users and just perform this as a utility cleanup maybe once a month.  Otherwise, if it happened often, you'd wanna build this into the forum to prevent table bloat, which would increase the seek time.
Print page generated: November 20, 2008, 5:49pm