News for hackers. Stuff that matters.
Re:How to assert that your SQL does not do full table scans by bpyne on Friday March 26, 2010 @10:36AM (#1221102)
What SQLServer provides is interesting: I need to read more about it.

From the Oracle side, you'd normally run the query through "explain plan". This utility generates the optimizer's plan for query execution. Reading the plan takes some practice but you clearly see where full table scans, indexes, etc. are used. All the Oracle databases I've developed against for the past 10 years use cost-based optimization: the plan utility shows you the cost at each step, the overall cost, the cardinality, and the space used.

If you want to get more into the system figures, you can set trace on and run the query. After execution, you'll have a file on the db server that shows disk I/O stats and many other system level measurements.

My own workflow is that I write the query first - typically nowadays in Toad - and run explain plan against it. I make sure the data returned is what is required and then move onto plan tuning. When I'm satisfied with the plan and overall cost, I copy/paste the query into my code.

It sounds like the overall workflow is different when developing against SQLServer.

Re:How to assert that your SQL does not do full table scans by vyrotek on Friday March 26, 2010 @11:02AM (#1221159)
My workflow is very different when using SQL Server. Usually it involves writing a query the only way I know how, sending it to a DBA to review it, getting laughed at and then having the DBA rewrite the whole thing.
Re:How to assert that your SQL does not do full table scans by bpyne on Friday March 26, 2010 @03:01PM (#1221771)
I feel for you. Eight years ago I worked in a department encouraging that workflow, except I was on the DBA team. We could be a little (let's be nice and say) menacing at times.