Heaps and indexes

  • Comments posted to this topic are about the item Heaps and indexes

  • Very interesting!

    Thanks!

    🙂

  • Weird. I'm not a DBA so I likely didn't really understand, but I executed this:

    select * from sys.indexes -- returned 159 rows

    I then executed the first statement (CREATE TABLE) and again executed:

    select * from sys.indexes -- returned 159 rows

    Finally, I executed the second statement (CREATE NONCLUSTERED INDEX ) and again executed:

    select * from sys.indexes -- returned 159 rows

    The count of rows in sys.indexes didn't change from the first execution.

  • Good question, thanks.

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

  • edwardwill (10/25/2016)


    Weird. I'm not a DBA so I likely didn't really understand, but I executed this:

    select * from sys.indexes -- returned 159 rows

    I then executed the first statement (CREATE TABLE) and again executed:

    select * from sys.indexes -- returned 159 rows

    Finally, I executed the second statement (CREATE NONCLUSTERED INDEX ) and again executed:

    select * from sys.indexes -- returned 159 rows

    The count of rows in sys.indexes didn't change from the first execution.

    Did you execute the statements in the correct database context?

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

  • Koen Verbeeck (10/25/2016)


    edwardwill (10/25/2016)


    Weird. I'm not a DBA so I likely didn't really understand, but I executed this:

    select * from sys.indexes -- returned 159 rows

    I then executed the first statement (CREATE TABLE) and again executed:

    select * from sys.indexes -- returned 159 rows

    Finally, I executed the second statement (CREATE NONCLUSTERED INDEX ) and again executed:

    select * from sys.indexes -- returned 159 rows

    The count of rows in sys.indexes didn't change from the first execution.

    Did you execute the statements in the correct database context?

    I executed the DDL statements against my test database, and the DML statements against master.

  • edwardwill (10/25/2016)


    I executed the DDL statements against my test database, and the DML statements against master.

    Then you get the index information of the master database.

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

  • Koen Verbeeck (10/25/2016)


    edwardwill (10/25/2016)


    I executed the DDL statements against my test database, and the DML statements against master.

    Then you get the index information of the master database.

    Cool. I learnt something!

  • Thanks Steve for this interesting question and cleverly constructed combination of the answers... 😉

  • Too easy.

  • Hmm... It took me about 5 minutes. Thanks, Steve!

  • Revenant (10/25/2016)


    Hmm... It took me about 5 minutes. Thanks, Steve!

    That long? 😀

  • Lynn Pettis (10/25/2016)


    Revenant (10/25/2016)


    Hmm... It took me about 5 minutes. Thanks, Steve!

    That long? 😀

    Yeah, that long. Well, maybe only 4. 😉

Viewing 14 posts - 1 through 13 (of 13 total)

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