Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Why this is faster?

Why this is faster?

Scheduled Pinned Locked Moved Database
performancequestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arun Immanuel
    wrote on last edited by
    #1

    Here are the 2 queries I tested for speed. select replace(convert(nvarchar(10),getdate(),108),':','') from tblName select replace(convert(nvarchar(10),getdate(),108),':','')***1** from tblName The former took 6 seconds and the latter took only 4 seconds. The table tblName has around 5 lakhs of rows. :confused::confused::confused:

    Regards, Arun Kumar.A

    C 1 Reply Last reply
    0
    • A Arun Immanuel

      Here are the 2 queries I tested for speed. select replace(convert(nvarchar(10),getdate(),108),':','') from tblName select replace(convert(nvarchar(10),getdate(),108),':','')***1** from tblName The former took 6 seconds and the latter took only 4 seconds. The table tblName has around 5 lakhs of rows. :confused::confused::confused:

      Regards, Arun Kumar.A

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Arun.Immanuel wrote:

      5 lakhs of rows

      Which means?


      Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      R A 2 Replies Last reply
      0
      • C Colin Angus Mackay

        Arun.Immanuel wrote:

        5 lakhs of rows

        Which means?


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        R Offline
        R Offline
        Rob Graham
        wrote on last edited by
        #3

        Colin Angus Mackay wrote:

        Reporting

        I think it means he's of the Indian persuasion.

        A 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Arun.Immanuel wrote:

          5 lakhs of rows

          Which means?


          Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

          A Offline
          A Offline
          Arun Immanuel
          wrote on last edited by
          #4

          I have 5,00,000 rows in the table tableName

          Regards, Arun Kumar.A

          A 1 Reply Last reply
          0
          • R Rob Graham

            Colin Angus Mackay wrote:

            Reporting

            I think it means he's of the Indian persuasion.

            A Offline
            A Offline
            Arun Immanuel
            wrote on last edited by
            #5

            Yes, You are right.:)

            Regards, Arun Kumar.A

            1 Reply Last reply
            0
            • A Arun Immanuel

              I have 5,00,000 rows in the table tableName

              Regards, Arun Kumar.A

              A Offline
              A Offline
              andyharman
              wrote on last edited by
              #6

              This one creates a column that takes about 13 bytes: select replace(convert(nvarchar(10),getdate(),108),':','') from tblName While this one casts the result into an integer (which takes just 4 bytes): select replace(convert(nvarchar(10),getdate(),108),':','')*1 from tblName The second is probably only faster because SQL Server can store the results in less space (or the data takes less packets to pass across your network.

              A 1 Reply Last reply
              0
              • A andyharman

                This one creates a column that takes about 13 bytes: select replace(convert(nvarchar(10),getdate(),108),':','') from tblName While this one casts the result into an integer (which takes just 4 bytes): select replace(convert(nvarchar(10),getdate(),108),':','')*1 from tblName The second is probably only faster because SQL Server can store the results in less space (or the data takes less packets to pass across your network.

                A Offline
                A Offline
                Arun Immanuel
                wrote on last edited by
                #7

                Thank you very much:):):)

                Regards, Arun Kumar.A

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups