Are the posted questions getting worse?

  • Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    I guess I'm high...

    CREATE TABLE dbo.T1 (col1 INTEGER PRIMARY KEY CLUSTERED, col2 INTEGER);

    GO

    CREATE VIEW dbo.V1 WITH SCHEMABINDING AS SELECT col1, col2 FROM dbo.T1;

    GO

    CREATE UNIQUE CLUSTERED INDEX ci_v1 ON dbo.V1 (col2);

    GO

    Want a third one?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS (4/10/2015)


    Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    I guess I'm high...

    CREATE TABLE dbo.T1 (col1 INTEGER PRIMARY KEY CLUSTERED, col2 INTEGER);

    GO

    CREATE VIEW dbo.V1 WITH SCHEMABINDING AS SELECT col1, col2 FROM dbo.T1;

    GO

    CREATE UNIQUE CLUSTERED INDEX ci_v1 ON dbo.V1 (col2);

    GO

    Want a third one?

    I want the second one either for the table or the view. :hehe:

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Does anyone have an idea on how to solve this problem?

    😎

  • Eirikur Eiriksson (4/10/2015)


    GilaMonster (4/10/2015)


    I love finding out that I'm giving a training course from the newsletter sent out the the entire company.

    Especially when it's pushed forward to the day of the publication, had one of those not to far back and ended up using some of the problems posted here on SSCentral as the examples, in fact when I found out/read the newsletter, people were already waiting:-D

    😎

    It can be even worse when the audience is external, or when what you say is going to determine wheter someone's proposal gets funcing and it comes to you with no notice.

    I was once caught out at a meeting that I attended after being assured by my boss that I would not be required to present anything and discovered on arrival that I was billed as explaining how industry was working on the meeting's topic.

    Another time I was asked to act as an evaluator for a proposal because someone couldn't make it, and given the impression I would be just a junior on the team so wouldn't have to do anything but apply technical judgement and state my opinion, so booked flights that would allow me to depart from and return to the UK on the same day as the proceedings were scheduled for about 5 hours; once the meeting was under way I discovered that I was to be the formal reporter for the process and had to obtain/engineer a concensus, and that the report was required for the same day, so that I would need to spend several hours after the meeting preparing a report and handing it over to the bureaucrats, leaving me with no chance at all of gettting on my flight back, and would need to find overnight accomodation in a city that was full of visitors because a massively attractive event (to others, not to people like me) was happening there. (I was worried at first, but much less worried once I had I discovered how magically EU bureaucrats could find a room in hotels that said they had no space, and persuade (or pay) an airline to adjust my non-adjustable ticket.)

    I regard this sort of thing as a learning opportunity, difficult and painful at the time, but in retrospect something really valuable as a learning experience. But I didn't feel that way at all the first couple of times it happened to me.

    Tom

  • Grant Fritchey (4/10/2015)


    Brandie Tarvin (4/10/2015)


    Look, Grant, there's a reason you didn't get the circus job. We just didn't want to break the news to you.

    <squeak>really?</squeak>

    And I showered and everything.

    Well, that may have contributed to the wet droopy hat problem, and the appearance of having somehow made your trousers (and jacket) wet. So when you shower, try to remember not to take off the things you'll need in their dry form unless you have time to dry them before the need becomes critical.

    Oh: also, remember to put them on again after showering but before you need them.

    Tom

  • Grant Fritchey (4/10/2015)


    Is everyone OK? Are people ill or something? Because this just happened and it has me concerned:

    Work deadlines and other stuff. Sorry, will do better next month

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    Well, kinda...

    An index that includes all the columns looks mostly like a clustered index, but it's not exactly a clustered index. For example key lookups will never be done to it, they're only ever done to the clustered index or the heap. There's a few other internal differences too.

    WayneS (4/10/2015)


    Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    I guess I'm high...

    CREATE TABLE dbo.T1 (col1 INTEGER PRIMARY KEY CLUSTERED, col2 INTEGER);

    GO

    CREATE VIEW dbo.V1 WITH SCHEMABINDING AS SELECT col1, col2 FROM dbo.T1;

    GO

    CREATE UNIQUE CLUSTERED INDEX ci_v1 ON dbo.V1 (col2);

    GO

    Want a third one?

    Still only one clustered index on the *table*

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Eirikur Eiriksson (4/11/2015)


    Does anyone have an idea on how to solve this problem?

    😎

    Extended events or the sys.dm_db_session_space_usage DMV which tracks tempDB usage per session (not per table, just overall space usage). Does mean you need to poll frequently so that you can join it to exec_requests and the sql_text DMVs. Extended events may be less work.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (4/13/2015)


    Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    Well, kinda...

    An index that includes all the columns looks mostly like a clustered index, but it's not exactly a clustered index. For example key lookups will never be done to it, they're only ever done to the clustered index or the heap. There's a few other internal differences too.

    WayneS (4/10/2015)


    Luis Cazares (4/10/2015)


    Someone just mentioned that you could have 2 clustered indexes on a table. But I'm sure he's high. 😀

    http://www.sqlservercentral.com/Forums/FindPost1676220.aspx

    But, think about it, what if you're in situation where, if you just had two clustered indexes on a table, you'd be set. INCLUDE all the columns, and it's exactly the same as a second clustered index. Done.

    I guess I'm high...

    CREATE TABLE dbo.T1 (col1 INTEGER PRIMARY KEY CLUSTERED, col2 INTEGER);

    GO

    CREATE VIEW dbo.V1 WITH SCHEMABINDING AS SELECT col1, col2 FROM dbo.T1;

    GO

    CREATE UNIQUE CLUSTERED INDEX ci_v1 ON dbo.V1 (col2);

    GO

    Want a third one?

    Still only one clustered index on the *table*

    Picky, picky.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • DAMN.

    Still getting the red X in SSMS 2012.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • GilaMonster (4/13/2015)


    Eirikur Eiriksson (4/11/2015)


    Does anyone have an idea on how to solve this problem?

    😎

    Extended events or the sys.dm_db_session_space_usage DMV which tracks tempDB usage per session (not per table, just overall space usage). Does mean you need to poll frequently so that you can join it to exec_requests and the sql_text DMVs. Extended events may be less work.

    Tanks Gail,

    Extended Events are definitely less work.

    😎

  • And this makes 14,001 posts. My fingers are tired.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (4/14/2015)


    And this makes 14,001 posts. My fingers are tired.

    Did you mean 0x3A99?

    😎

  • Grant Fritchey (4/14/2015)


    And this makes 14,001 posts. My fingers are tired.

    Congrats!

    (and you widened the gap between us. Well done old man :-P)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Grant Fritchey (4/14/2015)


    And this makes 14,001 posts. My fingers are tired.

    Well done, Grant. I'd say you've earned a victory beer, so enjoy it.

Viewing 15 posts - 48,181 through 48,195 (of 66,712 total)

You must be logged in to reply to this topic. Login to reply