What's surprising about this? #
Posted Monday 19th November 2007 22:18 GMT
The problem is usually not the data model. If the high level design is a reasonable match to the requirements and the data model was derived from that and then reduced to Third Normal Form its usually OK.
The problem is lack of communication. If there's no feedback to the database designers from the technical designers and module developers then the database indexes and storage schema are unlikely to match the access paths required for SQL to execute efficiently. Its as simple as that.
Typically, the system will pass acceptance tests and then show poor performance as the data volume builds up toward the designed levels. The DBAs can often sort out the problem by analysing SQL in the source repository to discover the access patterns and then adjusting the storage schema and indexing to suit: I've been there, and done exactly that. I've never needed to redesign the data model, but on a couple of occasions I have needed to rewrite SQL.
In the first case the SQL had been automatically generated by PowerBiulder and was obvious garbage. A simple manual rewrite reduced the response time from around 45 seconds to under a second. That was about a two hour fix from a cold start on the problem.
The second occasion was the result of a particularly lame-brained technique used by the MFC Foundation Classes when they had to expand the column list in a "SELECT * FROM..." statement. In this case all we had to do was to manually specify the column list (and kick some programmer arse for using the "*" shorthand in the first place) and again we got better than an order of magnitude speed up. The SELECT statements were only retrieving a row or two, but the MFC glob expansion technique forced an additional full table scan: not clever when the table contains tens of thousands of rows. This nonsense was due to some M$ coder not having read the ODBC manual (there was an almost zero cost ODBC function he should have used) and to his supervisors for not having done a code review.


