@swasheck No UNION is a logical concept. There are several possible physical implementations, only some of which involve sorting. Also, optimization may remove a UNION or translate it to something else given the context of the query as a whole. It is a mistake to try to correlate features from a declarative SQL statement to a particular physical implementation. That said, it is valid to look at an execution plan and wonder "where did that sort come from?"
Is there a better sargable way to get the date at midnight? Obviously my lack of sleep is getting to me. Current code -- CAST(FLOOR(CAST(getdate() AS FLOAT ))AS DATETIME)
@swasheck i'm working from home because my boss said "There's a release friday night...nobody else will be in the office...you should work from home too."
@swasheck I can never understand the general reluctance to post execution plans with table names and such in them. Do people really think they're using such amazing concepts that their whole business could be ruined this way? Pah.
@bluefeet It depends on the context, hang on a second.
@swasheck Oh I think I see your problem :)
@bluefeet Not when applied to a column reference, no (unless a convenient indexed computed column exists). It's fine as a seek value though:
DECLARE @T1 AS TABLE (some_datetime datetime PRIMARY KEY);
SELECT *
FROM @T1 AS t
WHERE some_datetime = DATEADD(DAY, DATEDIFF(DAY, '20000101', CURRENT_TIMESTAMP), '20000101');
Paul Dudley White (June 6, 1886 - October 31, 1973), American physician and cardiologist, was born in Roxbury, Massachusetts, the son of Herbert Warren White and Elizabeth Abigail Dudley. He was one of the leading cardiologists of his day, and a prominent advocate of preventative medicine.
Early life and education
White's interest in medicine was sparked early in life, when he accompanied his father, a family practitioner, on rounds and house calls in a horse and buggy. A 1903 graduate of the Roxbury Latin School, his undergraduate education at Harvard College encompassed history and fores...
I have created a linked oledb/odbc connection to Pervasive SQL from SQL SERVER 2012:
USE [master]
GO
/****** Object: LinkedServer [KSLAP208] Script Date: 2/8/2013 10:38:55 AM ******/
EXEC master.dbo.sp_addlinkedserver @server = N'KSLAP208', @srvproduct=N'Pervasive ODBC Interface', @provider...
@rfusca My advice is to not confront the teacher (unless you know he/she is a cool guy). I'd say to my daughter that is a Rhombus and some people call them Diamonds, too.
Up to age 10-11, teachers should be always right, in kids minds.
So I have the following date
ID NAME MONTH COUNT
1 David December2012 500
2 Rob December2012 320
1 David January2013 400
2 Rob January2013 280
I am trying to make this.......
ID Na...
Hi, I'm running a small webserver with a MySQL backend. I recently added indexes to a number of my tables, and ever since then my disk IO has gone up tremendously
I was seeing a bunch of "unindexed join" warnings prior to adding the indices, and I had slow performance prior to then, so that's why I added the indices
I really hate being called bro http://stackoverflow.com/questions/14779865/how-to-show-a-message-if-user-is-logged-out-because-of-session-time-out-in-php/14779885#comment20693267_14779885
Assume that I have a main table which has 100 columns referencing (as foreign keys) to some 100 tables (containing primary keys).
The whole pack of information requires joining those 100 tables. And it is definitely a performance issue to join such a number of tables. Hopefully, we can expect th...
So, one thing maybe that could be a hint: I had added an index to another table, but it seemed like it introduced a collision into one of my queries...e.g., two results were returned because the key only used the first 10 characters
Why do you think joining 100 tables would be a performance issue?
If all the keys are primary keys, then all the joins will use indexes. The only question, then, is whether the indexes fit into memory. If they fit in memory, performance is probably not an issue at all.
You should try the quer...
Down-voted that lazy-ass answer. Compilation time, dude.
ok, now everybody focus on @Guillochon who is aware dba.se exists and who is not a MySQL admin but who is having heavy IO issues and can't figure out why. He has a linode VPS and used MySQLTuner (or something like that) to tell him he needed indexes, and after adding those the system is nigh unusable.
He also has been referred to use the index luke already, so let that go too ;-)
There seems to be a real battle over this answer . . . several upvotes and downvotes. It would be really nice if the downvoters would explain their downvote. — Gordon Linoff50 secs ago
@jcolebrand well, i've said it before. Back when I was a heavy mysql user, adding too many indexes seemed to 'confuse' the planner, but it was an older mysql
2. the text columns. Three text columns make a table really wide. If all your tables are like this, it's not good. Of course you can't chop them to narrower columns, like VARCHAR(200) when they have comma-separated lists.
For the pressing problem of IO, I think that you should revert the changes and drop the indexes you have created. If that helps to bring into the sistuation you where before (no high IO), that's good.
I have two legacy SQL tables:
Contact
Id(uniqueidentifier, not null)
Foo
GlobalId(nvarchar(50, null)
EntityName(nvarchar(100, null)
The Foo.GlobalId column stores the ID from other tables in the DB, so to get at relevant data, we'd join tables like this:
select * from Foo
inner join ...
@swasheck Oh, now that's just pretentious. Anybody would think I'm just in the habit of hangout on web sites trying to amass internet reputation or something.
I am smooth. Sent the guy in accounting 5 PDFs as he's having issues hitting the SSRS site. 4 were the ones he was looking for, the 5th was a brochure explaining the benefits package of the place I interviewed at
soooooooooooooooo glad I wasn't on the team I used to be on for our application support. they're about to get reamed lol. They've been ignoring an alert all day and the boss couldn't get ahold of any of them