SQL antipatterns detection and database refactoring process

SQL antipatterns are frequently-made missteps that are commonly found in the design of relational databases, the use of SQL, and the development of database applications. They are intended to solve certain problems but will eventually lead to other problems. The motivation of this paper is how to assist database administrators in diagnosing SQL antipatterns and suggest refactoring techniques to solve the antipatterns. Specifically, we attempt to automate the detection of logical database design antipatterns by developing a tool that uses Transact-SQL language to query and analyze the database schema. The tool reports on potential antipatterns and gives an instruction on how to refactor the database schema. In an evaluation based on three databases from the industry, the performance of the tool is satisfactory in terms of recall of the antipatterns but the tool detects a number of false positives which affect its precision. It is found that SQL antipatterns detection still largely depends on the semantics of the data and the detection tool should rather be used in a semi-automated manner, i.e it can point out potential problematic locations in the database schema which require further diagnosis by the database administrators. This approach would be useful especially in the context of large databases where manual antipatterns inspection is very difficult.

[1]  Scott J. Ambler,et al.  Refactoring Databases: Evolutionary Database Design , 2006 .

[2]  Mirjana Ivanovic,et al.  Database refactoring and regression testing of Android mobile applications , 2012, 2012 IEEE 10th Jubilee International Symposium on Intelligent Systems and Informatics.

[3]  Fernando Kamei,et al.  What programmers say about refactoring tools?: an empirical investigation of stack overflow , 2013, WRT '13.

[4]  Hagen Schink sql-schema-comparer: Support of multi-language refactoring with relational databases , 2013, 2013 IEEE 13th International Working Conference on Source Code Analysis and Manipulation (SCAM).

[5]  Bill Karwin,et al.  SQL Antipatterns: Avoiding the Pitfalls of Database Programming , 2010 .

[6]  Eduardo Figueiredo,et al.  A review-based comparative study of bad smell detection tools , 2016, EASE.

[7]  Francesca Arcelli Fontana,et al.  Automatic detection of bad smells in code: An experimental assessment , 2012, J. Object Technol..

[8]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[9]  Erki Eessaar,et al.  On Query-Based Search of Possible Design Flaws of SQL Databases , 2015 .

[10]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.

[11]  Aiko Fallas Yamashita,et al.  Do developers care about code smells? An exploratory survey , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[12]  Gregory Vial Database Refactoring: Lessons from the Trenches , 2015, IEEE Software.

[13]  John Boyland,et al.  Integrating code smells detection with refactoring tool support , 2012 .