December 2, 2014 at 11:17 am
Ed Wagner (12/2/2014)
Eirikur Eiriksson (12/2/2014)
Luis Cazares (12/2/2014)
Sean Lange (12/2/2014)
David Burrows (12/2/2014)
Luis Cazares (12/2/2014)
...it can be easier to start from scratch if we can understand the problem, than fix a complete piece of s...
I have this problem every time I look at my old code :w00t:
Assuming by old code you mean anything written older than about 2-3 days I suffer from this too. π
That's why I don't review my code π
....very late hours....dark and stormy night, a door is....task number {bigint max}...optimize this query...scroll down to the beefy part..."who wrote this rubbish?"...scroll up to the comment header...Ooooops!
π
That's weird, Erikur. I haven't seen you in my office. I'm finding less and less of it as time goes on, but still find it every so often.
touchΓ©!
π
December 2, 2014 at 11:46 am
Jack Corbett (12/2/2014)
We are all anti-RBAR, but I would bet at some point early in our careers we wrote RBAR code because we didn't know better, I know I did. I think Chad's experience should be the goal.
Piffle and tosh! I never did no such thing!
I remember the first two months at my current job after a six week contract at my first ever official SQL Server DBA job. I wrote a SELECT statement and the manager of the project management team asked me "Why did you use WHERE X = 1 OR X = 2 OR X = 3 instead of WHERE X IN (1,2,3)?" At which point I responded "Because it's what I'm used to" in an effort to cover up the fact that I'd never had to write code complex enough to know that the "IN" or "NOT IN" clauses actually existed.
:blush:
Yeah. I remember dem good ol' days. Spaghetti code HO!
December 2, 2014 at 11:50 am
Jack Corbett (12/2/2014)
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?
There are all the regular ways in SQL Server: trace, xevents, DMV's. Also all of the ORM tools I am aware of have methods to output the generated SQL. For EF you can get LinqPad[/url] and work on EF queries to see what is being generated and try to tune the EF queries.
For Java we use JavaMelody[/url] and monitoring software.
The worst JPA code I have seen to update 30 rows in database generated 13 000 statements. Most of them where like SELECT id FROM TABLE WHERE id = 1
December 2, 2014 at 12:25 pm
Jack Corbett (12/2/2014)
Ed Wagner (12/2/2014)
GilaMonster (12/2/2014)
Sean Lange (12/2/2014)
This beauty was around 6,000 lines long. That was not a typo. It was a "single" query with something on the order of 200 instances of the word "select".And I thought the 2500 line login request was impressive...
Yeah, they both sound silly. EF might make things easy for front-end developers, but they sure are hard on the database.
Not to defend EF/Hibernate or any other ORM tool, but often times the issue isn't so much the tool as the fact that the developers really don't know how to use it. If the tool is configured and used properly I've seen EF generate acceptable code. Just like we can manipulate T-SQL to make a better plan, developers can access objects in different ways in some of the ORM tools and help it generate better code. We are all anti-RBAR, but I would bet at some point early in our careers we wrote RBAR code because we didn't know better, I know I did. I think Chad's experience should be the goal. Use the tool, understanding that moving forward there will need to be changes made including introducing SP's for complex queries. I've found it important to work to build a partnership with app developers and be willing to compromise. Once I've done that the app devs are usually willing to compromise as well, especially the good ones.
Myself being one of those developers I would agree. That being said I was able to convince the other developer to use EF but have the data access use procedures instead of the built in bulky garbage. One of the worst things we found is that a change in the database requires a complete rebuild of the object library even though the new data points are not used by the code in EF because the objects effectively use select *. :w00t:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 2, 2014 at 3:46 pm
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?
Perfmon for us too. I've been trying to move to XEvents, but when I'm under a crunch I still fall back on the tool I know best. I promise to do better in the future! π
December 2, 2014 at 5:23 pm
Chad Crawford (12/2/2014)
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?Perfmon for us too. I've been trying to move to XEvents, but when I'm under a crunch I still fall back on the tool I know best. I promise to do better in the future! π
Gag. XE works soooo much better and cleaner.
Create the session once and turn it on only when you need it. Easier to get it running that way when under a crunch. :-D:-D:-D
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 3, 2014 at 6:13 am
Stuart Davies (12/2/2014)
GilaMonster (12/2/2014)
For @#$^%&%$"The server's got 8 cores and 28GB of memory. It doesn't matter if it's scanning a 200 000 row table. It's not going to be a problem."
From the CTO.
Why don't you just tell me outright that you think I don't know what I'm talking about?
</rant>
Oh the wonders of "knowledge lacking"* employees! I'm sure there is a book to be written there.
Make it a big heavy thick one. Then we can hit them with it.
*That was the politest way I could think of phrasing it.
I'm a DBA.
I'm not paid to solve problems. I'm paid to prevent them.
December 3, 2014 at 6:21 am
SQLRNNR (12/2/2014)
Chad Crawford (12/2/2014)
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?Perfmon for us too. I've been trying to move to XEvents, but when I'm under a crunch I still fall back on the tool I know best. I promise to do better in the future! π
Gag. XE works soooo much better and cleaner.
Create the session once and turn it on only when you need it. Easier to get it running that way when under a crunch. :-D:-D:-D
Yeah XE is better once you get to 2012, but unfortunately I, and many others, are still supporting mostly 2008R2 servers for which I still rely on SQL Trace pretty heavily for things like this.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 3, 2014 at 7:43 am
Jack Corbett (12/3/2014)
SQLRNNR (12/2/2014)
Chad Crawford (12/2/2014)
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?Perfmon for us too. I've been trying to move to XEvents, but when I'm under a crunch I still fall back on the tool I know best. I promise to do better in the future! π
Gag. XE works soooo much better and cleaner.
Create the session once and turn it on only when you need it. Easier to get it running that way when under a crunch. :-D:-D:-D
Yeah XE is better once you get to 2012, but unfortunately I, and many others, are still supporting mostly 2008R2 servers for which I still rely on SQL Trace pretty heavily for things like this.
Even in 2008R2, XE beats the pants off trace. Capturing sql statements and even execution plans is sooo easy with XE.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 3, 2014 at 7:55 am
SQLRNNR (12/3/2014)
Jack Corbett (12/3/2014)
SQLRNNR (12/2/2014)
Chad Crawford (12/2/2014)
Stefan Krzywicki (12/2/2014)
How do you view the queries it generates? Are they persisted somewhere? Do you just see them through Perfmon? Something else?Perfmon for us too. I've been trying to move to XEvents, but when I'm under a crunch I still fall back on the tool I know best. I promise to do better in the future! π
Gag. XE works soooo much better and cleaner.
Create the session once and turn it on only when you need it. Easier to get it running that way when under a crunch. :-D:-D:-D
Yeah XE is better once you get to 2012, but unfortunately I, and many others, are still supporting mostly 2008R2 servers for which I still rely on SQL Trace pretty heavily for things like this.
Even in 2008R2, XE beats the pants off trace. Capturing sql statements and even execution plans is sooo easy with XE.
What about the non-R2 version of SQL 2008? Does XE work with that? (And what is XE?)
December 3, 2014 at 8:01 am
Brandie Tarvin (12/3/2014)
What about the non-R2 version of SQL 2008? Does XE work with that? (And what is XE?)
eXtended Events
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 3, 2014 at 8:05 am
Well it's been one of those days at work. Thankfully only 3 weeks left and then it's off to pastures new - well so long as I sort out a new contract!
Just found out a project I worked on that is finished but was delayed going into production will now be basically scrapped and re-written as the strategy has changed. So anything already live will use old strategy, everything else new. Well that bound not to confuse people...
By the way Brandie - XE = Extended Events
Also something else I'm just finishing off which includes sftp, I've just found out we are using a different process for sending files to external clients. I've just found out, emailed the PM, who has said can you sort this out with the Systems team - who have replied we are rather busy can this wait until the new year?
Rock meet Hard Place
Hard Place meet Rock
:w00t:
Rodders...
December 3, 2014 at 9:04 am
Don't knock LinkedIn too much. It's networking, which is incredibly valuable if you need employment or want to move. Many of you have used networking to advance, and while you might not need LI now, others do.
I like seeing recruiters on there. Some are stupid, but that's always been the case. At least now I get their stuff in my LI box, where I just whack it when I don't need a job. They're not offended. They'll still talk to me when I call them for a job.
If people want to use it as their status (Starbucks Pumpkin Spice is great), maybe they'll connect with someone. Maybe I'll think they don't do much real work and do more messing around. Maybe I'll buy them one when I meet them and remember.
December 3, 2014 at 9:35 am
Steve Jones - SSC Editor (12/3/2014)
Don't knock LinkedIn too much. It's networking, which is incredibly valuable if you need employment or want to move. Many of you have used networking to advance, and while you might not need LI now, others do.I like seeing recruiters on there. Some are stupid, but that's always been the case. At least now I get their stuff in my LI box, where I just whack it when I don't need a job. They're not offended. They'll still talk to me when I call them for a job.
If people want to use it as their status (Starbucks Pumpkin Spice is great), maybe they'll connect with someone. Maybe I'll think they don't do much real work and do more messing around. Maybe I'll buy them one when I meet them and remember.
+1
Wouldn't use the term stupid though, naΓ―f is probably more accurate description
π
December 3, 2014 at 9:57 am
Steve Jones - SSC Editor (12/3/2014)
Don't knock LinkedIn too much. It's networking, which is incredibly valuable if you need employment or want to move. Many of you have used networking to advance, and while you might not need LI now, others do.I like seeing recruiters on there. Some are stupid, but that's always been the case. At least now I get their stuff in my LI box, where I just whack it when I don't need a job. They're not offended. They'll still talk to me when I call them for a job.
If people want to use it as their status (Starbucks Pumpkin Spice is great), maybe they'll connect with someone. Maybe I'll think they don't do much real work and do more messing around. Maybe I'll buy them one when I meet them and remember.
One of my most common uses of L inkedIn is to get introductions. Most times I'm connected to someone who is connected to the company or a person in the company I'm looking into. It has been very helpful when looking at new opportunities.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 15 posts - 46,531 through 46,545 (of 66,709 total)
You must be logged in to reply to this topic. Login to reply