Are the posted questions getting worse?

  • GilaMonster (7/30/2012)


    ChrisM@Work (7/30/2012)


    Someone's just posted a reply to a request from Gail and my best guess is that she's fallen of her chair laughing. You're a bad lady, Gail. ๐Ÿ˜Ž

    Could you perhaps be specific about why I'm bad? No RotFL responses so far that I;ve seen.

    Gail: "Try ordering your output by a constant, using a bit of code cleverly disguised to look like a magical ordering doodah thingy".

    OP: "That's it, you've cracked it".

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • ChrisM@Work (7/30/2012)


    GilaMonster (7/30/2012)


    ChrisM@Work (7/30/2012)


    Someone's just posted a reply to a request from Gail and my best guess is that she's fallen of her chair laughing. You're a bad lady, Gail. ๐Ÿ˜Ž

    Could you perhaps be specific about why I'm bad? No RotFL responses so far that I;ve seen.

    Gail: "Try ordering your output by a constant, using a bit of code cleverly disguised to look like a magical ordering doodah thingy".

    OP: "That's it, you've cracked it".

    That was actually a serious suggestion, but only for the purposes of creating a new table with that new column immediately (before data growth causes the plan to change).

    Basically that says 'I want a row number ordered by whatever you like' and the optimiser being lazy just assigns the constants in whatever order it finds the resultset at the time the row number is assigned.

    Use that as part of an insert or select into and you can preserve a random order, but by itself it doesn't guarantee any order at all.

    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 (7/30/2012)


    ChrisM@Work (7/30/2012)


    GilaMonster (7/30/2012)


    ChrisM@Work (7/30/2012)


    Someone's just posted a reply to a request from Gail and my best guess is that she's fallen of her chair laughing. You're a bad lady, Gail. ๐Ÿ˜Ž

    Could you perhaps be specific about why I'm bad? No RotFL responses so far that I;ve seen.

    Gail: "Try ordering your output by a constant, using a bit of code cleverly disguised to look like a magical ordering doodah thingy".

    OP: "That's it, you've cracked it".

    That was actually a serious suggestion, but only for the purposes of creating a new table with that new column immediately (before data growth causes the plan to change).

    Basically that says 'I want a row number ordered by whatever you like' and the optimiser being lazy just assigns the constants in whatever order it finds the resultset at the time the row number is assigned.

    Use that as part of an insert or select into and you can preserve a random order, but by itself it doesn't guarantee any order at all.

    Understood, and it will preserve the order of the output set in the new table - but (if and) when the plan changes and the output order changes, it will preserve that too, surely? I can't yet see how it will help. Mondays, don't you love 'em?

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • The point is you do it once and check it. He checked and said that the row number does at the moment show the correct order. So you add that to the query once and insert into a table (which he said is what's being done). Then you have a permanent column to order by next time and from then onwards

    Basically, once off:

    Select <stuff>, RowNumber... as SomeOrder

    Into NewTable

    FROM <table>

    Then after that

    SELECT <stuff>

    FROM NewTable

    Order By SomeOrder

    Key statement from that post:

    Now here is the problem - i need to have a row_number added to this query, so i can transfer this order to a new table (i am going to have a field used for ordering). But I cant do row_number as i dont know the order by fields.

    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 (7/30/2012)


    The point is you do it once and check it. He checked and said that the row number does at the moment show the correct order. So you add that to the query once and insert into a table (which he said is what's being done). Then you have a permanent column to order by next time and from then onwards

    Basically, once off:

    Select <stuff>, RowNumber... as SomeOrder

    Into NewTable

    FROM <table>

    Then after that

    SELECT <stuff>

    FROM NewTable

    Order By SomeOrder

    Key statement from that post:

    Now here is the problem - i need to have a row_number added to this query, so i can transfer this order to a new table (i am going to have a field used for ordering). But I cant do row_number as i dont know the order by fields.

    Can't knock it - it answers the OP's question.

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    Nice to see you all playing relatively nicely.

  • Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    Nice to see you all playing relatively nicely.

    That's just because we didn't know you were gone. See, don't tell us and we behave. :w00t:

  • Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    I'm sorry. Won't happen again.

    Change topic: What to do with a week on a desert island. </gloat>

    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 (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    I'm sorry. Won't happen again.

    Change topic: What to do with a week on a desert island. </gloat>

    Which desert island?

    Mauritius (nice beaches and if you stay on the beach could be called a desert island)? La Reunion (prefer to think of dessert in this case)? Other?

    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

  • SQLRNNR (7/30/2012)


    GilaMonster (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    I'm sorry. Won't happen again.

    Change topic: What to do with a week on a desert island. </gloat>

    Which desert island?

    Mauritius (nice beaches and if you stay on the beach could be called a desert island)?

    Yup. Only 4 hours away.

    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 (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    I'm sorry. Won't happen again.

    Change topic: What to do with a week on a desert island. </gloat>

    well, as long as it's not deserted, and stocked with drinks, I vote for packing lots of books. Also currency to exchange for alcoholic drinks.

  • Steve Jones - SSC Editor (7/30/2012)


    well, as long as it's not deserted, and stocked with drinks, I vote for packing lots of books. Also currency to exchange for alcoholic drinks.

    Loooots of books going.

    Don't drink alcohol, so the last is not required. Though money for nicknacks is.

    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 (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    well, as long as it's not deserted, and stocked with drinks, I vote for packing lots of books. Also currency to exchange for alcoholic drinks.

    Loooots of books going.

    Don't drink alcohol, so the last is not required. Though money for nicknacks is.

    Sounds wonderful Gail. I hope that you thoroughly enjoy yourself.

    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

  • GilaMonster (7/30/2012)


    SQLRNNR (7/30/2012)


    GilaMonster (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    Hmmm, I go to SQL Saturday #144 and this thread goes from water cooler to technical discussion.

    I'm sorry. Won't happen again.

    Change topic: What to do with a week on a desert island. </gloat>

    Which desert island?

    Mauritius (nice beaches and if you stay on the beach could be called a desert island)?

    Yup. Only 4 hours away.

    I am very jealous. I have been to Mauritius only once - 1995. I really want to get back there as a vacationer the next time.

    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

  • GilaMonster (7/30/2012)


    Steve Jones - SSC Editor (7/30/2012)


    well, as long as it's not deserted, and stocked with drinks, I vote for packing lots of books. Also currency to exchange for alcoholic drinks.

    Loooots of books going.

    Don't drink alcohol, so the last is not required. Though money for nicknacks is.

    Have a great time.

    "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

Viewing 15 posts - 37,186 through 37,200 (of 66,738 total)

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