开发者

Help finding old SQL tool that rewrote queries [closed]

开发者 https://www.devze.com 2022-12-19 12:00 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_运维问答

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

There was this old sql server tool called Lectoneth or something like that, you'd put sql queries in it, and it would rewrite it for you.

I think quest bought them out, but I can't find where to download a free copy of that software.

Really helps when you have no dba, and have lots of sql queries to rewrite.

Thanks

Craig


Doesn't ring a bell, and presumably you've seen, but nothing obvious on Quest's website

Perhaps a tool like Red Gate's SQL Prompt would help - the Pro edition does SQL reformatting.

Edit
Think i've found what you're looking for, mentioned here - LECCO SQL Expert. The link to the Lecco website does indeed direct to quest, but a 404.

LECCO SQL Expert is the only complete SQL performance tuning and optimization solution offering problematic SQL detection and automatic SQL rewrite. With its built-in Artificial Intelligence (AI) based Feedback Searching Engine, LECCO SQL Expert reduces the effort required to optimize SQL and makes even the most junior programmer an expert.

Developers use LECCO SQL Expert to optimize SQL during application development. DBAs eliminate problematic SQL before users experience application performance problems by using LECCO SQL Expert in production systems.

Looks like it's no longer about - all mentions of I could find indicated it supported up to SQL 2000, and stale links - looks like it wasn't a free tool. As said in my comments, I think this kind of thing is a skill well worth possessing and would benefit in the long run to not relay on a tool to try and do it for you.

I wasn't aware of this tool before now, so I have picked up something from this question - got me intrigued!

Final Update:
To confirm, that product has indeed gone as Lecco was acquired some years ago now. Thanks to Brent Ozar for confirmation.


I think you're looking for a product that's been merged into Toad for SQL Server. The commercial version of Toad has a SQL Optimizer feature that tries lots of ways to rewrite your SQL statements, then tests them to find which ways are the fastest.

You can download Toad here:

http://www.toadsoft.com/

But be aware that that feature is a paid-version-only feature.


Well rather than spending your time looking for a magic bullet, why not spend some time learning performance tuning (you will need a book, this is too complex for the Internet generally). Plus it is my belief that if you want ot write decent new code, you need to understand performance in databases. There is no reason to be unable to write code that avvoids the most common problems.

First, rewrite every query to use ANSII syntax anytime you open it up to revise it for any other reason. Code review all SQl changes and do not pass the code review unless explicit joins were used.

Your first step in performance tuning to identify which queries and procs are causing the trouble. You can use tools that will tell you the worst performing queries in terms of overall time, but don't forget to tune the queries that are run frequnetly as well. Cutting seconds off a query that runs thousands of times a day can really speed things up. Also since you are in oprod already, likely your users are complaining about certain areas, those areas should be looked at first.

Things to look for that cause performance problems:

Cursors

Correlated subqueries

Views that call views

Lack of proper indexing

Functions (especially scalar function that make the query run row by row insted of through a set)

Where clauses that aren't sargeable

EAV tables

Returning more data than you need (If you have anything with select * and a join, immediately fix that.)

Reusing sps that act on one record to loop throuhg a large group of records

Badly designed autogenerated complex queries from ORMs

Incorrect data types resulting in the need to be continually be converting data in order to use it.

Since you have the old style syntax it is highly likely you have a lot of accidental cross joins

Use of distinct when it can be replaced with a derived table instead

Use of union when Union all would work

Bad table design that requires difficult construction of queries that can never perform well. If you find yourself frequently joining to the same table multiple times to get the data you need, then look at the design of the tables.

Also since you have used implicit joins you need to be aware that even in SQL Server 2000 the left and right implicit syntax does not work correctly. Sometimes this interprets as a cross join instead of a left join or right join. I would make it a priority to find and fix all of these queries immediately as they may currently be returning an incorrect result set. Bad data results are even worse that slow data returns.

Good luck.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号