473,700 Members | 2,510 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 1901
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
2612
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
3003
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 and disadvantages but I will not discuss them now). Dynamic typing allows us to change types of...
5
2069
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 with variables. They can then select a template, and for each variable in the template, type in a...
1
2836
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
5150
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
8
1877
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
2101
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 night if I could check he has given me 100% of the database and three months down the line I am...
3
2706
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? Checking active connections by user is also an option if thats the only way to do it as all...
0
1506
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 cities: city_id | country_id | city_name
0
8731
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9219
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7819
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2032
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.