473,560 Members | 2,918 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking for redundant database tables

Hi,
I've inherited a mysql database with many apparently redundant tables (probably abandoned projects).
Without analysing the webpages many of which are also redundant; is there any MYSQL query which can
tell which tables haven't been accessed for say 6 months.
What strategies can I use?
Jul 20 '05 #1
4 1892
zzapper wrote:
Hi,
I've inherited a mysql database with many apparently redundant tables (probably abandoned projects).
Without analysing the webpages many of which are also redundant; is there any MYSQL query which can
tell which tables haven't been accessed for say 6 months.
What strategies can I use?


The most sure way is to do a complete code review of your web apps
(including any offline tasks, cron jobs, etc.), and keep a tally of
which tables are touched by the code. But here's a somewhat less
labor-intensive technique:

1. Enable the general query log
http://dev.mysql.com/doc/mysql/en/Query_log.html
Or if your query log has been active, go look at that log file.

2. Leave it going for a few months, until you are fairly confident that
all code in your web apps has executed at least once.

3. Do some analysis or grepping on the query log to find a list of
tables that were touched.

4. Those tables that you believe haven't been accessed, make them
inaccessible. Change the table name, or use privilege management to
restrict access from the user that the web apps connect as.

5. DO NOT LOSE THE DATA. Inevitably something will turn out to be needed.

6. Wait until you get MySQL error messages in the logs, or irate phone
calls, and then start debugging to figure out which of the obsoleted
tables must be restored to accessibility.

7. Repeat as needed for about two years.

Regards,
Bill K.
Jul 20 '05 #2
On Thu, 28 Oct 2004 10:54:39 GMT, in mailing.databas e.mysql zzapper
<da***@tvisnosp am.co.uk> wrote:
| Hi,
| I've inherited a mysql database with many apparently redundant tables (probably abandoned projects).
| Without analysing the webpages many of which are also redundant; is there any MYSQL query which can
| tell which tables haven't been accessed for say 6 months.
| What strategies can I use?
|

You could use: 'Show table status' to return the creation date/time,
last update date/time.

You'd have to do this for each database.
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 20 '05 #3
Jeff North wrote:
You could use: 'Show table status' to return the creation date/time,
last update date/time.

You'd have to do this for each database.


That's a far simpler solution that what I posted! LOL

But it doesn't find instances where the tables were read, but not updated.

Regards,
Bill K.
Jul 20 '05 #4
On Thu, 28 Oct 2004 11:25:01 -0700, in mailing.databas e.mysql Bill
Karwin <bi**@karwin.co m> wrote:
| Jeff North wrote:
|
| > You could use: 'Show table status' to return the creation date/time,
| > last update date/time.
| >
| > You'd have to do this for each database.
|
| That's a far simpler solution that what I posted! LOL
|
| But it doesn't find instances where the tables were read, but not updated.


True, but I haven't seen/used any databases that contain completely
static data.

The show status function is a good starting place to see what has been
changed and when but like most things, there still needs to be human
intervention to make judgements upon actions.
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2606
by: Rusty Wright | last post by:
Is there a newsgroup for mysql? I'm trying to figure out if it's possible to write a query or shell script for CHECK TABLE so that it steps through each database with USE and then checks each table in that database. It's too bad mysql doesn't have a CHECK DATABASE. I'm using innoDB so I can't use myisamchk. Thanks
5
2990
by: Tongu? Yumruk | last post by:
I have a little proposal about type checking in python. I'll be glad if you read and comment on it. Sorry for my bad english (I'm not a native English speaker) A Little Stricter Typing in Python - A Proposal As we all know, one of the best things about python and other scripting languages is dynamic typing (yes I know it has advantages...
5
2066
by: gordy | last post by:
edit: this came out longer than I thought, any comments about anything here is greatly appreciated. thank you for reading My system stores millions of records, each with fields like firstname, lastname, email address, city, state, zip, along with any number of user defined fields. The application allows users to define message templates...
1
2831
by: Chad Reid | last post by:
I was wondering what the VBA code would be to test to see if a view already exists, or how to overwrite a view if it already exists. Also, how would I do the same for a regular table? Database: Access 97 Connection: ADO 2.0 Please reply to my email aswell as the group if possible.
99
5062
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
8
1875
by: Brendan | last post by:
There must be an easy way to do this: For classes that contain very simple data tables, I like to do something like this: class Things(Object): def __init__(self, x, y, z): #assert that x, y, and z have the same length But I can't figure out a _simple_ way to check the arguments have the
2
2094
by: Simon.Whiteside | last post by:
If someone has created a database for me and transferred it over is there any way that I can check I have full access to all areas? I am a beginner with Access and so the development has been done by a temporary employee who has now handed the database over to me. Not that I think he is an untrustworthy character but I would sleep easier at...
3
2697
by: gazy2k4 | last post by:
I'm writing a program that connects to MS SQL Server, on start up it clears some tables in one database, and repopulates them from another database. I would like this to only happen if there are no other connections to the database I'm clearing. Is there any way of checking the amount of active connections on a specfic database within code? ...
0
1501
bilibytes
by: bilibytes | last post by:
hi, I was wondering how to determine whether an information is redundant or not. if you have in a table "Main", the basic information for a thing: thing_id | name | image_id | city_id ok if i want to know the country_name for some thing_id, i will have to make two subqueries. because i have the location organized this way: Table...
0
7632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7552
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7841
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3605
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2047
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1169
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.