Finding opportunities to refactor

Refactors and formats SQL code.

Moderators: Chris Auckland, David Atkinson, Anu Deshpande, Luke Jefferson

Finding opportunities to refactor

Postby petemounce » Fri Apr 23, 2010 1:55 pm

So, I have a legacy database that I need to maintain. Changes are allowable, and in fact desirable - no grand re-writes here. However, just finding out which parts are still used is, well, _hard_.

One of the techniques I'd like to get some kind of tool support for is to get a summary of all of the columns of a table (or, why not all tables) that meet a set of criteria - like:
* all values in the row for the column are null
* the column only has a single value in it (so is unnecessary)
* the column only has a single value in it, when the row-set is restricted to the last x that were inserted to the table (ie, the column has _become_ unnecessary within some timeframe dictated by the range of table-rows)
* column usage does not show up in a given sql-profiling session
* column usage does not show up in a given other-profiler-tool session (eg nhprof)

This would allow me to target my software-archeology efforts within the applications on top of the database, and let me trim out the cruft that much quicker.

I don't know if Data Compare can already do this, but I think that my use-case is more refactoring-oriented, so I decided to post here.
petemounce
 
Posts: 1
Joined: Fri Apr 23, 2010 1:49 pm
Location: London, UK

Postby Anu Deshpande » Mon Apr 26, 2010 10:35 am

Many thanks for your post.

SQL Refactor is designed to Refactor the schema hence cannot serve the purpose in the mentioned scenario at the moment neither will Data Compare.

I have logged this as a feature request in our internal tracking system whose tracking id is SR-882.

I will update you as soon as it is incorporated.
Anuradha Deshpande
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
Anu Deshpande
 
Posts: 692
Joined: Mon Apr 20, 2009 3:53 pm
Location: Cambridge


Return to SQL Refactor 1

Who is online

Users browsing this forum: No registered users and 0 guests