Why this is faster?
-
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 tabletblName
has around 5 lakhs of rows. :confused::confused::confused:Regards, Arun Kumar.A
-
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 tabletblName
has around 5 lakhs of rows. :confused::confused::confused:Regards, Arun Kumar.A
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
-
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
Colin Angus Mackay wrote:
Reporting
I think it means he's of the Indian persuasion.
-
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
I have 5,00,000 rows in the table
tableName
Regards, Arun Kumar.A
-
Colin Angus Mackay wrote:
Reporting
I think it means he's of the Indian persuasion.
Yes, You are right.:)
Regards, Arun Kumar.A
-
I have 5,00,000 rows in the table
tableName
Regards, Arun Kumar.A
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. -
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.Thank you very much:):):)
Regards, Arun Kumar.A