Jump to content
  • 0

Database Optimisation - Delete Unused Accounts


TouchOfFlames

Question

12 answers to this question

Recommended Posts

  • 0

use lin2db

select * from user_account

where last_login > 2013-08-29 replace date.

 

 

well if you want an automatic script you'll have to use joins\innerjoins to delete between lin2db\lin2world

Read up on SQL queries - and how delete from several tables with 1 select.

 

EDIT:

 

Ninja edit - i'd probably create multi'tiered Stored Procedure to run by SQL agent.

 

so you first delete from table where last_login > DATEADD(mm,-30,GETDATE()) --// example with 30 days not logged accounts.

from user_account

 

and then run a series of queries for user_data etc like this:

 

DELETE FROM [lin2db].[dbo].[user_auth] WHERE account Not In (SELECT account FROM [lin2db].[dbo].[user_account]);

DELETE FROM [lin2world].[dbo].[user_data] WHERE account_id Not In (SELECT uid FROM [lin2db].[dbo].[user_account]);

 

same for char_id in user_item and all other tables.

Link to comment
Share on other sites

  • 0

use [lin2db]

select * from user_account

where last_login > 2013-17-01

 

returns same record all over the time , no matter what date do I setup.

Shows ALL records from user_account not sorted by date

 

where last_login = 2013-17-01

where last_login < 2013-17-01

last_login > DATEADD(mm,-30,GETDATE())

 

Does`t give Returns at all

 

use [lin2db]

DELETE * from user_account

where last_login > DATEADD(mm,-30,GETDATE())

 

Incorrect syntax near '*'.

Link to comment
Share on other sites

  • 0

DELETE * from user_account

 

remove * not used - seriously try a bit yourself.

 

where last_login < 2013-17-01

 

needs to be > - it's reversed bits in the way dateformat is stored.

Link to comment
Share on other sites

  • 0

Btw and all the characters, if any, what happens with them ? It shouldn't be better to remove the characters and their data 1st and then lin2db ? In fact i didn't needed to optimize lin2db it isn't kicked so hard, lin2world has a nice kick on the harddrive.

Link to comment
Share on other sites

  • 0

Btw and all the characters, if any, what happens with them ? It shouldn't be better to remove the characters and their data 1st and then lin2db ? In fact i didn't needed to optimize lin2db it isn't kicked so hard, lin2world has a nice kick on the harddrive.

Good point. I think I will make a querry for that.

Link to comment
Share on other sites

  • 0

Because associating the unique remove factor - by account id is easier than weird inner joins with login dates from user_auth.

 

Same with then having to remove data from user_item, and other bigger tables.

 

 

start from top, and remove down heirachy wise :P

Link to comment
Share on other sites

  • 0

Because associating the unique remove factor - by account id is easier than weird inner joins with login dates from user_auth.

 

Same with then having to remove data from user_item, and other bigger tables.

 

 

start from top, and remove down heirachy wise :P

I my next release of GM Panel I will add a future for that.

Link to comment
Share on other sites

  • 0

Because associating the unique remove factor - by account id is easier than weird inner joins with login dates from user_auth.

 

Same with then having to remove data from user_item, and other bigger tables.

 

 

start from top, and remove down heirachy wise :P

And what about the content ? If new people creates new accounts the system won't assign them the empty numbers ? Giving new accounts other chars ? Or it adds numbers exponentially ?

Edited by Sighed
Link to comment
Share on other sites

  • 0

If you delete chars from acc and from all tables in lin2world base i doubt that this problem will happen.

Edited by xeL
Link to comment
Share on other sites

  • 0

Primary Key solves those issues - with the account_id and name.

 

That's why starting to remove from the top - and then remove user_data , and then on to skill, item etc etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...