473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 1880
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.database.mysql zzapper
<da***@tvisnospam.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****@yourpantsbigpond.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.database.mysql Bill
Karwin <bi**@karwin.com> 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****@yourpantsbigpond.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
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...
5
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...
5
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,...
1
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? ...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
8
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,...
2
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...
3
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...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.