« first day (1035 days earlier)      last day (3837 days later) » 
03:00 - 23:0023:00 - 00:00

3:23 AM
Anyone here tried to snapshot a database that's part of an availability group? I'm assuming you either can't do it, or when you revert to the snapshot the database gets taken out of the group?
 
4:00 AM
Oh boy.... Ruby on rails user trying to store passwords in the db using reversible encryption....
0
Q: How to search an encrypted attribute?

topherI have a sensitive attribute that must be encrypted at all times except during display (not my rule and I think it's overkill, but I must follow this rule). Additionally, the secret used to encrypt/decrypt this data must not be on or accessible through the database. So currently I have a session ...

 
4:15 AM
(yeah, that will end well, I am sure)
 
 
7 hours later…
11:37 AM
:-P they just keep coming.
0
Q: Best SQL\NoSQL solution for specified requirements?

Spacemanthere's a data set with around 6 millions of records. Each record has the same number of fields. There are 8 fields totally: ID Title Color Date1 Date2 Date3 Date4... There should be a way to filter these records by title and all date fields (or, 'columns' in RDBMS terms). The size of t...

"We don't have joins there, the data is already optimized for big data solutions. Only one 'big table'."
3
ummmm a several GB table, no joins, lots of indexes, and he wonders why it is slow.
 
> We don't have joins there, the data is already optimized for big data solutions. Only one 'big table'.
@ChrisTravers This says it all:
 
12:01 PM
@ypercube My answer was a bit longer than this but the general sense was that they needed to hire a consultant to help them sort it out.
Also note that although the db is only a few GB, they figured to get speed they should put it on a system with 32GB of RAM.
The whole question is full of so many WTF's that "hire a consultant" seems to be the best answer.
 
12:14 PM
I truly would like to meet Aptem one day
> I just got my head around left outer joins
really you have asked 1.3K+ questions
1
Q: Is there a general relationship between left outer join and PIVOT?

Артём ЦарионовI just got my head around left outer joins, and I am practicing PIVOTS. I am wondering whether it is possible to convert this query into a pivot? SELECT mydrawercustomer.customerface, mydrawerordertype.ordertypeface, mydrawerorder.LM, Datediff(hour, a1.playdate, a2.playd...

 
1:12 PM
"Is there a software to fast get grip of database I could use?" If there was such a tool, I'd like to be on the selling side please ;) But seriously, stupid design is not an argument, it's an allegation. Not everything we don't like or disagree with is actually stupid. — geomagas 2 mins ago
There is a software, it's called "brain". geomagas is being polite.
 
I feel like I just serially downvoted this user but all of their answers are awful
 
@bluefeet Shall we credit him for finding 3 questions he can answer with the exact same answer?
 
@ypercube I would typically say yes but considering they are purely link only answers...NO!
 
It seems he only answers in triples.
One triple with a link to his tutorial and another triple with a link to his tool (XAML inspector, which is not yet available! xamlinspector.com/download.html)
 
I know, I am going to flag at least one in each set.
I flagged them, we'll see if they get declined
 
 
1 hour later…
2:48 PM
Are you kidding me???
0
Q: Restore Database from latest .bak

Matthew VassalloIs it possible to restore database from the latest .bak file using sql script?

 
JNK
you can restore databases from backups now?
What's next, wet water?
 
expensive gas
 
gas has been going down by me
 
yeah but it's still expensive
I paid $3.15 this weekend when filling up a rental car. But Detroit shouldn't count.
 
filled up at costco last week for $3.04
 
3:02 PM
3$ per gallon? That's cheap (if I've done the conversions correctly)
 
Well, when I moved to Rhode Island in 1997, it was < $1
 
@ypercube I filled up in Italy over the summer. I think it was around $10/gallon according to my conversions
 
In fact I remember going to the grand canyon and taking a picture of the Mobil station there, which had crazy gas prices - $1.99
In Ireland this year I paid close to $10/gallon.
Italy was cheaper I think
Plus I had a tiny Fiat 500 so I only had to fill up once driving halfway across the country.
It's been hovering around $4 in RI/MA for the past few years. Seeing it dip toward $3 is nice but we need to stop relying on foreign oil and these oil companies need to stop being able to turn billions and billions in profit on something that is still a necessity.
 
Did you hang an onion on the rear view mirror, which was the style at the time?
 
I'm not a big fan on government intervention in commerce, but like electricity I think there needs to be a bit more regulation or profit capping or something.
 
3:10 PM
I think I remember reading somewhere that gas prices are more or less stable when adjusted for inflation. Human psychology at work.
 
JNK
I remember reading that too
 
Google found me something to back that up: inflationdata.com/Inflation/Inflation_Rate/…
 
@AaronBertrand was contemplating buying a tesla
There just aren't enough stations around yet and getting a charging station installed at home is too costly as we're planning on moving in the next 3-4 years
 
@Twinkles but it's annoying to see gas prices skyrocket, then see the oil companies post record quarters and their CEOs get 8-figure bonuses. The cost of my electricity doesn't seem to change with inflation; I'm looking at bills from 5-6 years ago and they trend the same.
@FreshPrinceOfSO yeah that technology isn't there yet. Plus limited production and high prices.
 
@AaronBertrand i hope to own an electric car in my lifetime
 
3:17 PM
Me too. But it won't be anytime soon.
I drive way too far to remote areas. Glenn Berry has a Tesla but he doesn't drive very far - grocery store etc. and that's about it.
He lives near Denver and there are charging stations around.
 
That's another consideration. Will have to stop to charge on cross country trips.
If it's for in range city driving, that's fine. But then are you going to buy another car for long distance driving?
 
Right, and currently this could mean altering your route significantly. Or perhaps that the trip isn't even possible.
 
I've ridden in Glenn's Tesla. It was the most frighting 10 seconds of my life. And then the rest was pretty cool.
Accelerating from 0 to 60 with constant acceleration and NO SOUND is freaky, to say the least.
 
3:37 PM
I don't know if this is too dumb of a question for the site. If I change the settings on a linked server provider, that only affects linked servers right?
 
@EugeneM Are you talking the provider options?
 
@MikeFal oh man ... i can imagine
 
@MikeFal Yeah, I want to change some provider options to MSSQL can talk to MYSQL but I want to make sure I'm not going to break anything
 
@EugeneM Yeah, that should only affect your linked servers.
 
@MikeFal I figured, but any time I have to change production, I get twitchy
 
3:52 PM
As well you should.
 
@EugeneM I concur with @MikeFal
 
4:07 PM
move to dba
0
Q: Create new user for local instance of SQL Server

svagerI am attempting to set up a development machine. One of the components is SQL Server 2008 R2. I log in into the machine as local administrator and then I am trying to use windows authentication to log in into local instance of SQL Server. When I try to change password for sa I get error: C...

 
i dont always answer questions, but when i do, i make sure they're abandoned and guaranteed to never get another look
4
 
Thought this might be appropriate over here as well
0
Q: SQL Server 2012 Service Master Key Regenerate

ninjaplayerI have a new SQL Server 2012 instance and when I run the following command I get an error. ALTER SERVICE MASTER KEY REGENERATE Error: Msg 15329, Level 16, State 1, Line 1 The current master key cannot be decrypted. If this is a database master key, you should attempt to open it in the se...

 
like, awesome to the max, bro
0
Q: Understanding Indexes and using them to the max

JamesI've been spending some time trying to optimise some MySQL queries that we use which essentially joins one table with 2 million rows onto another which has 1-2 million. I know MySQL is able to easily handle this, however we use a lot of GROUP BY clauses and pseudo tables to reduce our data to bui...

@MikeFal local boy makes good, eh? way to go Doug
 
4:28 PM
He's not a local boy, he's from Alaska
Ain't none of you colorado kids actually from there as best as we were able to determine at the saturday of sql
 
@billinkc true. but he's local now
that's all that matters around here for now, i reckon
 
4:50 PM
@billinkc I've been here for 20+ years. I'm fairly certain I've gone native.
 
If you'd gone native, you'd have built a safe cracking robot by now
You will have one built before next SQL Saturday Denver or I am staying in your house and not leaving until the McGuffin has been opened
 
@swasheck I'm super excited for Doug. He's a perfect fit for that group.
 
@MikeFal good guy.
 
@billinkc I think you have me confused with a different type of geek.
 
"I couldn't, I'm not that kind of geek." ~@MikeFal
@MikeFal are you doing lunch down here tomorrow?
 
5:00 PM
@swasheck No, in the office on that day. I'll need to sort that going forward, but for the immediate future I've got other things to juggle.
 
@MikeFal ok
 
Why are people so bad at date/time? I gave up commenting on all these (albeit slightly) inaccurate answers
0
Q: SQL Date Range only show data for the last hour

user1426542I want to do a mssql date range to return the data for an hour time range. Meaning, I want to return the data for the last hour, but not for the last hour from the current time. Declare @today datetime set @today=GETDATE() select * from table1 where datetime>= DATEADD(hh,-2,@Today) For examp...

 
5:16 PM
@AaronBertrand Because StackOverflow
 
can "StackOverflow" be a valid predicate?
 
It find it incredibly weird how how hard it is for people to move away from DD MM stuff like that.
 
not everyone is as smart as ... well ... a 5-year-old
 
You think people would look at DD and DAY and instantly think well I'll use DAY
Those must be the same people who come up with crapy non descript column names.
 
well, we've certainly grown used to interpreting date formats that contain all these DD, MM, YYYY etc.
they've been around for quite a while, so not surprising many would think them perfectly clear
the problem is, many would also not realise that they are clear only when in a proper context
 
5:25 PM
@AndriyM that's very true.
 
Is it just me or are the images on @AaronBertrand blog post broken?
nevermind
just refreshed
 
@FreshPrinceOfSO just you :)
for just that moment
 
thanks seth
 
5:40 PM
@AndriyM most people in my presentations fail the DATEPART(W, ...) and DATEPART(Y, ...) quiz.
 
@AaronBertrand I'd fail it too if I weren't in here all the time listening to you talk about it. :)
Of course, one of the many advantages to being in The Heap.
 
Well I
'm going to throw in ones that are intuitive too, and that people will guess correctly.
The way I've got the quiz phrased now, it's obvious that it's a trick question.
I tried to stump Hugo at a recent event, but he was on to me. I did stump Erland.
...and several other MVPs as well.
 
So ummm how about them Chiefs
 
@billinkc the ones that were killed in the american indian wars?
 
I was simply trying to redirect my attention away from the savory comment of senor fal
 
5:46 PM
@billinkc lucky. a goal-to-go false start (which made the gratuitous hit on Tuel unpenalizable) and the Bills would have iced the game in the first half
 
What's the phrase, I'd rather be lucky than good?
Apply that liberally and you get 8-0
 
@billinkc of course now we have the excuse of "our coach has no heart ... we're depressed" but we all know they Peyton Manning is the actual offensive coach/coordinator
@MikeFal i spoke with that guy at the summit (not knowing who he was ... just looking at him in a picture). i think it's unfair to cast all mvps in the mold of a few chowderheads
 
@billinkc SSIS question. Trying to do a derived column; this expression is giving me an error: REPLACE(originalColumn, '-infinity', NULL)
 
Use double quotes
 
> Attempt to find the input column named "NULL" failed with error ....
 
5:52 PM
LOL
-1
A: Intellisense underlines UDF name in red but it still works

DiegoDid you just create the UDFs? You may need to refresh the Intellisense(if you don't know how, just quit SSMS and open it again)

 
And possibly need to use the correct flavor of null (DT_WSTR). Look at the casts/null section and you'll see what i mean
 
If you don't know how, just quit SSMS. Because I'm too lazy to actually tell you.
 
ctr-shift-r
 
Hmm we've got a lot of removed comments in here.
 
@Zane making fun of people
 
5:56 PM
@Zane you missed it
@FreshPrinceOfSO not making fun ... just presenting some honest truth
 
I assumed it was a little smack talk lol
 
i know where i slot in within the sql hierarchy :)
 
@swasheck Most MVPs are smart and good, but it needs to be remembered that the MVP is not a technical certification, but a recognition of community participation.
 
@AaronBertrand My comment was removed.
@ypercube or, solidify earth's molten core causing the magnetosphere to cease, effectively stripping away earth's atmosphere and killing everything on earth. then, fire it back up again ... — Xander 1 min ago
Next escalation will involve back holes or wormholes.
 
VtC as that one was a duplicate
 
6:12 PM
@billinkc i'm trying to pull data from vertica and the data type is coming over as "DT_DBTIMESTAMP2" however, there are values such as "-infinity" and "NaN" which i'm trying to change to NULL using the expression [col] == "-infinity" || [col] == "NaN" ? NULL : [col]
 
my response is huh?
0
A: Best practice - 'forgotten username' process

Joe joeBut you must think the way you are thinking, because, in reality, how many people do you trust and i mean truley trust as in you would leave $50,000 in their possession and go on holiday, without thinking about the money, knowing that when you return it will be there no question asked no doubts r...

 
Let's have 40 follow-up questions
So I read your article on chunking the delete and while it had a significant positive impact on log size, the performance gains were less dramatic. Is this just a consequence of the I/O bottleneck? — rohitsan 1 min ago
 
oh @ypercube you are funny
-1 for trusting your wife with $50K — ypercube 2 mins ago
I think that is my favorite comment ever
 
I wonder if these will come down in price within 30 days
 
6:26 PM
@bluefeet It all got deleted unfortuantely as that my have been the single greatest answer in the history of SO.
 
gee, can you tell when I'm traveling? :-)
On dba.se, it looks the same just about every day.
 
@FreshPrinceOfSO You need to provide the flavor of the NULL thus [Col]== "-infinity" || [Col] == "NaN" ? NULL(DT_WSTR, 30) : [Col]
@AaronBertrand This is what I'm telling myself I don't need to buy and replace the existing HD on this work laptop with amazon.com/gp/product/B00BQ8RGL6
 
Almost a TB for $600, that's pretty reasonable
 
@AaronBertrand (glad plug in commercial song) rub it in, rub it in
@billinkc ugh i hate ssis
but thank you
 
Anyone have one of these? eheat.com
 
6:32 PM
@MikeFal i totally understand
 
@AaronBertrand my parents do and they love them
 
We need a solution to my daughter's room - 2 degrees colder than our room because of the way the thermostat and vents are set up
 
@AaronBertrand out of my price range
 
And I'm trying to find an alternative to adding a third furnace to the house (or modifying the existing one in the attic to support two zones)
 
@FreshPrinceOfSO Do observe your data types at the end. You might need to wrap that entire expression with a a cast like (DT_WSTR, 30)([Col]==...)
 
6:34 PM
@AaronBertrand I would try that first. When I visited them in April I had one in my room and it really kept it warm
 
@bluefeet did they have concerns about safety? My wife is paranoid because space heaters.
 
@bluefeet how does it feel traveling to normal climates?
@AaronBertrand safer than building a fire in your daughter's bedroom
 
well der
 
@FreshPrinceOfSO But on demand s'more source cannot be denied
 
@AaronBertrand they are much different from space heaters. My folks are currently renting a house that is very cold so they placed these in each of the cold rooms. They love them
 
6:36 PM
safer than oil based space heaters
 
@AaronBertrand Space heaters have become a lot safer as well.
 
But are they safer and warmer than a sliced open tauntaun?
 
@AaronBertrand but will all seriousness, my grandmother uses one of those oscillating ones. my only concern with a small child would be the front being hot and them touching it... those wall panel heaters seem like a good choice. i'm sure you could return it
@AaronBertrand just make sure it doesn't overload your circuit (not sure how much energy it draws)
 
Oh slicing open a tauntaun every night would be awesome though
 
Except for the smell
 
6:38 PM
@AaronBertrand My folks used to have a space heater but these are much better. You can touch the heater and you will not be burned because the mechanics are much different. My two little great-nieces are walking around and there is no concerns about these heaters
 
That's what masks are for
 
@billinkc the null part works for me.. how can i cast the string?
REPLACE(published_date, CAST "-infinity" AS (DT_DBTIMESTAMP2, 6) , NULL(DT_DBTIMESTAMP2,6))
 
@FreshPrinceOfSO we are not constantly hot in AZ. We do have a winter here
 
@bluefeet what's winter? like 90* ?
 
@FreshPrinceOfSO actually no, a few years ago I ran a half-marathon in January and it 27 degrees when I was dropped off for the start of the race
 
6:42 PM
@bluefeet no way!
 
@MichaelFredrickson can attest to the fact it isn't always hot in Arizona
that was perfect timing for him to join
 
Yea... last winter there was a frost and everyone's trees all died... also there's snow around on the mountains sometimes...
(But usually it's hot)
I don't own a coat...
 
@FreshPrinceOfSO Make that your overall cast. To save your sanity, add a derived column after then one that cleans up the incorrect values and let that one just perform the cast to datetime
 
@MichaelFredrickson not even for the winter? How long have you lived here?
 
@MichaelFredrickson Just the naturally shiny coat you were born with, based on your avatar
 
6:46 PM
@bluefeet I was born here... I guess it's more related to how little I go outside rather than what the weather is like...
 
@MichaelFredrickson ah ok, I have family who were born here and they own coats. It gets cold in the winter.
 
@bluefeet "they own coats" just sounds so weird
 
Arizona has huge overnight temperature drops if I remember correctly?
 
@Zane some days
not so much in the summer - we will fluctuate from the 110s as the high and then the 90s for a low
the winter/fall we can swing a bit more sometimes 50-60 degree change from hi to low
 
7:02 PM
I bet `-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.` are the most common two lines in stored procs across all installations of SQL Server
 
@billinkc what common task would i use to fetch only top 50 for example?
 
Could you clarify the context?
Top 50 rows in a data flow, top 50 files in a folder, etc?
 
like a bottle of Châteauneuf-du-Pape
 
from the source, i only want top 5 rows in the data flow
 
I would do that in my source extract
top/limit/fetch whatever vertica supports
 
7:13 PM
wth is a source extract
 
Whatever your source component is (OLE DB Source, ADO.NET, etc)
 
bear with me
i'm using an ODBC source
 
I say Extract because I assume you wrote a query to extract the data from the underlying system vs just selecting the table name in the drop down
 
instead of using table name access mode, i would use sql command?
 
Bingo
 
7:14 PM
@billinkc you're brilliant
deserve a nobel prize
 
Selecting tablename usually leads to poor performance for two reasons. The first is that in SQL Server at least, it results in a wrapped call to an openquery that does select * and the second reason it should generally be avoided is that unless you want every column brought into the data flow, you should specify what you want so that you don't waste memory.
2
If you do want every column, you should enumerate them so that the addition of a column to the source system doesn't cause headaches later on in life.
 
@billinkc I agree with this statement 100%
I reject a lot of packages for using the choose table name.
 
Finally, there is a Row Sampling component that will grab a random sample (go figure) of data but that will wait until all the rows have been sent before it can determine which ones. There's some vague hand waving with that but I'm pretty sure it's accurate
 
that's insightful
 
nice title
0
Q: I am pretty much new to sql server, I am trying to do this... Not sure what I am doing wrong

GudiyaI am pretty new to SQL Server, I am trying to do this... Not sure what I am doing wrong Here is my schema: CREATE TABLE [Product_AGGREGATION]( [Product_ID] [int] NULL, [ITERATION] [int] NULL, [EQUIPMENT_USED] [varchar](8) NULL, [MODEL_USED] [varchar](25) NULL, [SERIAL_NUMBER] [v...

 
7:19 PM
Nested cursor, yes you really don't know what you're doing
 
I tried not to be too mean
Can you edit your post with a title that actually explains your problem? — bluefeet 50 secs ago
 
Oh, they already observed that they have nested cursors and that's probably not ideal
 
ahhh SP_ we meet again.
 
7:38 PM
@ypercube you have some nice weather
 
@ypercube Actually, for a long time I had been under impression this would be your normal weather in this time of year until you mentioned the other day that some regions of Greece can have snow in winter
 
@AndriyM Athens is generally nice, even in October-November but this year we had a week only of low temperatures in October. Otherwise, it feels like an extended summer.
 
@ypercube Very much like it is where I live. We had a couple of unusually cold weeks in September, as if they were swapped with November
But now it's like our normal September, +15 C at 7am, and about the same at this moment (9:50pm)
 
8:00 PM
It's cold and wet here.
@ypercube Almanac shows a historical high of 82 however 75 would be nice.
The historic range for High temps in Minnesota today is crazy.
5 to 75 °F
 
8:23 PM
It's 80°F and sunny here today :D
 
@SimonRigharts :(
 
@Zane Actually I'm bad at math, it's only 70°F
I blame America for holding on to antiquated measures when everyone else has moved past them
 
@SimonRigharts We fear change pain.
 
Hi everyone.. sysadmin from serverfault here :) Is it considered on-topic to ask a question on the DBA site, without having much clue around how SQL queries are formed/optimized? I've been assigned the joyful task of troubleshooting why one of our functions runs in less than a second, while another function that points to the first function uses 18 seconds..
I doubled the amount on the server with a thread of hope, but that did not help
 
@pauska As long as you're willing to learn and put a bit of effort in (i.e. your question isn't "slow query halp plz") then you're good to go :)
 
8:30 PM
@SimonRigharts Agreed. I'd love to take a look at it.
 
@SimonRigharts Guess I'm lucky then, I've been a sysadmin for 15 years and the recent SQL work has been quite nice. I'd love to learn more about how it all works together.
The developers nearly carried me on their arms one day when I implemented index/statistics maintenance at nights.. so it's not all bad
I'll start writing up the question then.. takes a while, quite the lengthy function..
 
@pauska That might be your problem right there.
 
@Zane So, did you buy the Nexus 5?
 
@Lamak I'm on Verizon
 
@Zane oh, ouch
carry on then
 
8:38 PM
@Lamak Yeah....
I had my creidit card ready then bam. No dice.
If Verizon doesn't get their act togather on Nexus devices I'm going to switch.
 
@pauska is this for SQL-Server?
 
@Zane speaking from ignoance.....can't you just buy it from the play store?
 
@Lamak It won't work on Verizon's network.
 
@Zane oh, so that's the issue. Sorry, just got back from some mini-vacations and was unplugged from news
 
Yeah they are having some sort of issues with Google. It's obnoxious.
 
8:41 PM
I was sure you were gonna buy it
 
@Lamak I would love to.
However I'm mid contract on a group plan. Also Verizon has the best coverage by a wwide margin in my area.
 
@Zane well, if I buy it, I'll let you know if it's worth it (I'm sure it is)
 
@Lamak It doesn't have any of the bloatware that my device has soo. There's always that.
 
@Zane which one do you have now? (I have the N4)
 
I have a Samsung GS3
 
8:46 PM
@ypercube Yes, SQL 2008 R2 with CU6
 
@Zane It's a good phone though. Can you have the google play version of the S3? or was that just for the HTC One and the S4?
 
@Zane Well, the function itself runs fast.. the problem arises when another function calls it
 
@pauska I think we have definately found your problem then.
@Lamak Those two are GSM only
 
@Zane I'm not sure what to make of that.. could you elaborate?
 
@Zane really?, didn't know that
 
8:48 PM
@pauska In my experience having a function that calls another function is usually a sign of troubles.
@Lamak Yeah. Verzon is still on CDMA for voice so.
11
A: Insert entire DataTable into database at once instead of row by row?

Aaron BertrandSince you have a DataTable already, and since I am assuming you are using SQL Server 2008 or better, this is probably the most straightforward way. First, in your database, create the following two objects: CREATE TYPE dbo.MyDataTable -- you can be more speciifc here AS TABLE ( col1 INT, col...

I love the accepted answer.
 
@bluefeet Oracle error, yet tagged as
0
Q: SQL group by "column name"

Luke14I cant seem to see why this query is failing, in my group by clause I have the columns that are in my select yet im still getting the error. Why is this? Below is my query; SELECT c.customer_first_name, c.customer_last_name, MAX(SUM(cost_line)) FROM customers c LEFT OUTER JOIN orders o USING(cus...

 
9:04 PM
@FreshPrinceOfSO Probably thinks he's using mysql and can't tell the difference
 
@SimonRigharts ha
 
0
Q: table-valued function runs fast on it's own, dreadfully slow when called from another table-valued function

pauskaDisclaimer: I'm a senior sysadmin who's trying to help our development team speed up the production database. Our users are hurting, bad. Please don't shoot me for not being great with SQL The database server is a Windows Server 2008 R2 with the latest updates applied, running SQL Server 2008 R2...

@Zane hope this clears it up.. I'll stick in this room if someone wants to give a hand or ask more questions.. I'm always in the serverfault chat anyways :)
 
Ok, that was weird. Anyone know of why FT indexes wouldn't be recreated in a restored backup of a database?
 
Ack, zee goggles, zhey do nothing
 
That which has been seen
 
JNK
9:17 PM
@MikeFal FT catalogs are outside file groups
 
@JNK Not in 2008 R2. They put an end to that silliness
 
JNK
ORLY
 
YARLY
 
JNK
You did a full backup and it aint in thar?
 
Yeah. I recreated them, just wierd
 
9:19 PM
<----- Sofa King Dense
 
I do dump/restores of our database with a FT catalog on it all the time, it's always there when I restore.. 2008 R2
 
@billinkc and i thought they smelled bad on the outside
@MikeFal cause SO a world of pain
Jeff Atwood on November 01, 2008

You may have noticed that things have been less responsive than usual on stackoverflow.com. The culprit is SQL Server 2008 full-text search. I’ll let Brent explain:

Before 2008, full text search wasn’t inside the database – it wasn’t subject to things like transactions. Heck, it was more like Lucene where it lived outside on its own. Now, it’s stored inside data files and it’s subject to transactions. From what im hearing, blocking and locking is a completely new issue in 2008 FTS. There’s a big overhead involved with making it subject to transactions. …

 
9:32 PM
@swasheck I love the comments that suggest to use WITH (NOLOCK)
 
9:46 PM
Oh, and wow
0
Q: table-valued function runs fast on it's own, dreadfully slow when called from another table-valued function

pauskaDisclaimer: I'm a senior sysadmin who's trying to help our development team speed up the production database. Our users are hurting, bad. Please don't shoot me for not being great with SQL The database server is a Windows Server 2008 R2 with the latest updates applied, running SQL Server 2008 R2...

 
@AaronBertrand dont knock it ... it's how the folks in meeshigan get their daily food
 
@SimonRigharts Mind if I just ask here instead of the site? It could lead to a very long list of comments back and forth.. I ran the T-SQL commands you gave me, and seems like I'm getting four rows for the affected DB
@AaronBertrand thanks for bashing me, I'm right here :)
 
@pauska wow = wall of code
There's no bashing
 
@AaronBertrand I saw a documentary on deer migration today!
 
I even posted a comment
 
9:53 PM
aaah
sorry, I thought it was "wow this is some shit"
 
I made the title a bit more digestible
 
thanks
I didn't know that I could set recompile options inside a function.. let me try
I really, really need to get the CTO to hire a DBA.. this is madness.. one of these functions depends on 5 other functions, pluss a ton of tables across different databases.. It's nearly impossible for someone like me to troubleshoot it
 
@pauska no, I don't think you can, but you can try using it in whatever queries are calling the functions.
 
JNK
@pauska Nested udfs normally points to a web or OO programmer mucking around in a database
I have a few of those here
My favorites are the scalar udfs that are just wrappers for OTHER scalar udfs
 
Call all the functions!
 
JNK
9:58 PM
they use those because the outer/wrapper udf is in a check constraint so it can't be changed without rebuilding the constraint
 
Oh jesus, this explains why the queries were suddenly blazing fast when we modified the function.. that forces a recompile
 
@PaulWhite Lol.
 
@JNK You are spot on..
 
JNK
@pauska Breaking stuff up into functions is a good idea in a non-database scenario
when you work on more than one record at a time it causes issues
 
nobody here is a DBA.. they just started putting things into SQL, which worked great when there were 20 users in this monster ERP system.. now there's 120 users and a load of reports going all day long..
@JNK from what the CTO told me - he started creating lots of different functions because it was so much easier for him to add functionality later on
 
JNK
10:00 PM
I've been trying to think of an analogy to use here and I think it's like comparing a dirt bike and a tractor trailer
 
one function that mines all the data in, another one that calls the first function and does some extra magic etc..
 
JNK
The route you take in the dirt bike is a lot different than the tractor trailer
but if you wanna move 20 tons of something it's better to take that longer road in a tractor trailer
@pauska ugghh
 
I've been pushing for budget so that we can hire a DBA and set up a BI database with integration services.. I really don't see the point of transforming all of this data every single time someone opens a tiny report
 
JNK
@pauska that is one of those small shop getting big problems
The terrible TSQL code that worked fine on your 100,000 record database doesn't scale
but it USED to work so the powers that be point to some other cause
 
@JNK and it's not like we're HUGE either, but this specific function is getting a lot of data from two databases, 25GB each..
 
JNK
10:01 PM
Because the code hasn't changed :)
ok time to head home
Lovely daylight savings its already dark out at 5
 
@AaronBertrand that's the harder part.. I have no control of where they call these functions.. it's inside VB, C#, and ASP.NET
 
JNK
@pauska good luck
 
@JNK thank you
 
JNK
And don't be a stranger in here if you need more database help
 
I'll hang around, you've been most helpful all of you
and come to the comms rom if you need "halp my server bsod"
 
10:04 PM
That's what we're here for. We'll mail you the bill.
We are, after all, a consultancy. :)
 
@pauska it seems odd that they would go to great lengths to encapsulate this code in functions, yet opt for ad hoc SQL embedded in the applications instead of stored procedures. Someone was vastly confused.
 
@JNK this is standard time, i thought ... DST was what just ended
 
That's true - if they abolished DST it would still be 5:13 on the east coast, and dark
Though I'm all for getting rid of that nonsense.
 
10:20 PM
me too
 
@AaronBertrand they do use stored procedures.. but I don't think it's consistent
From what I've been explained, they're using something called Entity Framework, which apparently does all sorts of magic SQL stuff..
 
So, where they use stored procedures, fix it there. Where they don't, tell them to use stored procedures, and then fix that once.
Oh gross. That is my cue to go get dinner, sorry.
 
ALTER ROLE db_denydatareader ADD MEMBER [EntityFrameworkUser]
I'm sorry Dave, you can't read the table anymore. How about a nice stored procedure instead
If I'm allowed to mix my computers
 
Someone once told me not to overuse stored procedures.. were they full of piss?
 
@pauska Most likely.
You can run into problems with inappropriate parameter sniffing, but they're relatively few and far between
and you can fix that with OPTION (RECOMPILE) (very dirty hack, last resort) or OPTIMIZE FOR UNKNOWN
 
10:38 PM
Yeah, I've read a bit about OPTIMIZE FOR
is the general idea to optimize for the query with the most data? cause the function i'm trying to debug can generate all from one row to several thousands.. latter being extremely I/O expensive on the tempdb
 
@pauska You optimize for what's causing you the most pain at the moment :)
 
Yes, that would be the "all departments and all employees" :(
 
You can also use plan guides (never used them myself, but they might be an option)
 
I have to get them to rewrite this into a stored procedure first
I can't do anything at all with these functions.. I tried to create a wrapper (a stored procedure that calls the function with a OPTIMIZE) but that didn't help at all
 
10:59 PM
y'all will be faster than wading through BOL. They restored production to our stage environment. We have encryption going on so there's a database master key and service master keys involved. DBAs neglected to do the needful on the keys when they restored so we're running into errors stating it can't access the key
 
03:00 - 23:0023:00 - 00:00

« first day (1035 days earlier)      last day (3837 days later) »