Finding opportunities to refactor
petemounce
Posts: 2
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.
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.
Comments
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.
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com