SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Do you know your getdate()?


Do you know your getdate()?

Author
Message
SQLZ
SQLZ
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1704 Visits: 940
I get 3.3 ms here using your own code.

The worst part about it is you would have not given the job to someone who correctly responded with 3.3ms for GETDATE() precision:-P

Karl
source control for SQL Server
adrian.buzila
adrian.buzila
SSC Eights!
SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)SSC Eights! (962 reputation)

Group: General Forum Members
Points: 962 Visits: 268
If you get 15.6521 it does not mean that this is the precision of getdate()!

Why do you think that @Time and @TimeEnd have succesiv values?

The conclusion, in my opinion, is the your system is very good (count is only 595 so only 595 times @Time and @TimeEnd are different, on my system is gets 18475), but the load of you system is very high, your processor is taken by another process from time to time so you get a very big value for the "precision" (in my case is 3.34344).
Daniel Tonagel
Daniel Tonagel
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
Points: 15 Visits: 23
matthieu.ravard (5/12/2010)
is the other instructions present in the code takes some millisecond ?


Doesn't matter as long as you get several loop iterations before the timer gives another value.
wschampheleer
wschampheleer
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1122 Visits: 303
WIN XP SP3 / SQL Server 2008 SP1 on dual core machine

getdate: 6043 3.3399 & 5957 3.33557
sysdatetime: 1713 15625 & 1789 15625

Regards,

Willem
http://wschampheleer.wordpress.com
Leendert van Staalduinen
Leendert van Staalduinen
SSC Journeyman
SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)

Group: General Forum Members
Points: 99 Visits: 397
My results on a single Windows 2000 Professional SP4 machine:
- In SQL Server 2000 Query Analyzer: did not run within 5 minutes runtime, I do not understand why.
- In SQL Server 2000 SP4, via Access .ADP file: 1,418 / 15.62,
- In SQL Server 2005 SP2, via Access .ADP file: 789 / 15.62.

Hope, this adds to the discussion, Leendert.
Leendert van Staalduinen
Leendert van Staalduinen
SSC Journeyman
SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)

Group: General Forum Members
Points: 99 Visits: 397
P.S. I was too impatient: the very same Windows 2000 Professional SP4 machine, SQL Server 2000 Query Analyzer, after 7:44 minutes: 27,553 / 16.8266. The Access .ADP file return results after 12–22 sec.

I stop trying to understand all these differences, Leendert.
thisisfutile
thisisfutile
SSC-Addicted
SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)SSC-Addicted (494 reputation)

Group: General Forum Members
Points: 494 Visits: 1001
From my XP workstation, running the first query only, if I connect to my local SQL 2008 install then I get the 3.3333 time. If I connect to our Server's SQL 2005 install, I get the 15.6xxx time.

Just wanted to share my experience.
JacekO
JacekO
SSC Eights!
SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)

Group: General Forum Members
Points: 890 Visits: 615
Wow.
I did not expect to get so many posts before I even show up for work.
Looking at all the replies, one potential explanation for some of the 'better' precision numbers for GETDATE() might be possible.
64 bit OS.
Looks like whoever run the tests on 64 bit OS got the 3.33 ms precision and whoever run it on 32 bit got ~16 ms presicion.

If anyone of you got the 3.33 ms on a 32 bit box please reply with more specifics on the OS, CPU and SQL Server version. I don't think anything else could explain the difference. I did to run the tests on different configurations but I have to admit I did not have access to a 64 bit OS.

---------------------------------------------
Nothing is impossible.
It is just a matter of time and money.

wschampheleer
wschampheleer
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1122 Visits: 303
I got 3.33 ms on a 32bit OS: WIN XP SP3 / SQL Server 2008 SP1 on dual core machine (Intel T2500).

Regards,

Willem
http://wschampheleer.wordpress.com
JacekO
JacekO
SSC Eights!
SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)SSC Eights! (890 reputation)

Group: General Forum Members
Points: 890 Visits: 615
SQLZ (5/12/2010)
I get 3.3 ms here using your own code.

The worst part about it is you would have not given the job to someone who correctly responded with 3.3ms for GETDATE() precision:-P


Well, life is tough.;-)

But seriously, back then, when I was in the position to interview people I did not care as much what knowledge did they have but rather what could they do with it.

---------------------------------------------
Nothing is impossible.
It is just a matter of time and money.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search