SV650.org - SV650 & Gladius 650 Forum



Idle Banter For non SV and non bike related chat (and the odd bit of humour - but if any post isn't suitable it'll get deleted real quick).
There's also a "U" rating so please respect this. Newbies can also say "hello" here too.

Reply
 
Thread Tools
Old 20-10-14, 10:29 AM   #11
Heorot
Member
 
Join Date: Jul 2012
Location: South Norfolk
Posts: 341
Default Re: OMO: SQL query tools

Keith_d, I apologise in advance if the following appears condescending, it's meant to be helpful.

if you want to write efficient SQL it is essential that you understand how relational databases work. A relational database contains many sets of related data that are linked by keys. In order to get the individual elements within the sets, you need to know which data elements are held in which sets. You should then look for the keys within those sets and use them to join them. As kaivalagi says, if you are going to use SQL more than occasionally, then you should go on a short course to learn the basics.
__________________
Some say the cup is half empty, while others say it is half full. However, both are wrong; the real problem is the cup is too big.

Honda 125 CG blown engine Gone to the great mechanic in the sky
Naked SV650 K3 in Silver
Heorot is offline   Reply With Quote
Old 20-10-14, 12:26 PM   #12
kaivalagi
Member
Mega Poster
 
Join Date: Jun 2010
Location: Norwich
Posts: 1,955
Default Re: OMO: SQL query tools

Brettus, I'm more than happy to answer any questions you might have off the back of self learning, I'm sure a few others here would be too

Best not to use graphical tools for building queries unless you already understand the basics and can interpret what they are producing and tune as necessary

Like Heorot says if you can understand the basic premise of tables/views/sets of data and their keys/indexes/relationships you can create some half decent flat queries of the wanted columns from that data...

If you get into more complex stuff like aggregations within sets of data that then form new relationships to other data etc etc then you need to get to grips with more technical solutions that utilise CTE/temp tables/table variables etc or even step towards using SSIS for churning through big amounts of data and handling it's transformation as a pre-requisite for reporting data etc , all this needs a little experience really though...

Let us know if we can help! To start with have a look for "MS SQL Client Tools" and download and install the correct version on your desktop for your SQL server version
__________________
Mark

Triumph and Suzuki owner

Last edited by kaivalagi; 20-10-14 at 01:16 PM.
kaivalagi is offline   Reply With Quote
Old 20-10-14, 09:02 PM   #13
Brettus
Guest
 
Posts: n/a
Default Re: OMO: SQL query tools

Cool! thanks for all the replies guys. Sorry for lack of reply, I've been reading every response (honest!)

I think my current problem is I'm not sure what my problem is. I like the visual design so I can quickly link the fields and it also helps me to lay it out (I resort to whiteboarding my queries first too) I'll see how I get on and when I've got an example of a problem (other than the clunky and CTRL-Z lacking query editor) I'll let you know.
  Reply With Quote
Old 20-10-14, 09:43 PM   #14
kaivalagi
Member
Mega Poster
 
Join Date: Jun 2010
Location: Norwich
Posts: 1,955
Default Re: OMO: SQL query tools

The visual design GUI for sql reporting will help you see the data and relationships but as you've seen it is limited. To me it sounds like you ought to use it to form a basic query and then play with it in the sql client tools until it runs right. In the query analyser there are options to see the actual execution plan etc for a query so you can see where a lot of time is being spend on operations, this can help you identity where indexes are lacking etc. There are a lot of other tools that can help too, worth getting familiar with the client tools and what they can help you with for sure!

Have a play and get back with any questions, it will be worth it to go down this road...getting a query wrong can cause table scans etc which have the knock on effect of blocking tasks which cause unwanted delays and or timeout exceptions within the database application etc
__________________
Mark

Triumph and Suzuki owner

Last edited by kaivalagi; 20-10-14 at 09:47 PM.
kaivalagi is offline   Reply With Quote
Old 21-10-14, 08:06 PM   #15
Heorot
Member
 
Join Date: Jul 2012
Location: South Norfolk
Posts: 341
Default Re: OMO: SQL query tools

Going back to keys. One thing to be aware of is that the key of a set (usually called a table) might comprise more than one element. To get a direct access, you will need to access the table using all the elements. That's why kaivalagi's suggestion that you look at the execution plan will save you hours of frustration. Some tools will identify where there is a non-indexed join.
__________________
Some say the cup is half empty, while others say it is half full. However, both are wrong; the real problem is the cup is too big.

Honda 125 CG blown engine Gone to the great mechanic in the sky
Naked SV650 K3 in Silver
Heorot is offline   Reply With Quote
Old 21-10-14, 10:01 PM   #16
kaivalagi
Member
Mega Poster
 
Join Date: Jun 2010
Location: Norwich
Posts: 1,955
Default Re: OMO: SQL query tools

Quote:
Originally Posted by Heorot View Post
Some tools will identify where there is a non-indexed join.
Yep, in MSSQL that's normally going to result in a table scan in the execution plan taking up a high percentage of the overall execution, very easy to see.

There is also a tuning wizard that can be utilised to highlight indexing worth messing with...it's within the profiler tool and just requires logging of traced activity of the database first, e.g. http://www.datasprings.com/resources...ookieSupport=1

There's loads of good stuff to get your teeth into Brettus, a geeks dream come true lol!
__________________
Mark

Triumph and Suzuki owner
kaivalagi is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools, Halfords Advanced general tools thefallenangel Hardware 35 26-04-12 02:24 PM
Re: Tools Whyte25 Bikes - Talk & Issues 22 26-05-11 12:04 PM
Help with tools :) sprocket SV Talk, Tuning & Tweaking 2 28-01-08 08:58 PM
Need tools - help skint Bikes - Talk & Issues 7 05-05-07 09:05 AM
Tools trudd SV Talk, Tuning & Tweaking 11 14-11-06 05:19 PM


All times are GMT. The time now is 01:15 PM.


Powered by vBulletin® - Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.