« How do I build a ctrl-A delimited string? | Main | How do I declare a table column of type string (not symbol!)? »

How can I measure the performance of my q code?

The simplest way to time something in q is to use the \t command:

q)f: {[] do[100000; 2 + 2]}
q)\t f[]

\t executes its argument and returns the number of milliseconds that elapsed - i.e., wall clock time (except when you are using \t in its other sense, i.e., setting or getting the time between timer events).

When using kdb as a database server, you will want to use one or more of Simon's logging scripts as a starting point. These tremendously useful scripts enable you to record every incoming query as well as measure the time taken by every incoming query. That way you can calculate summary statistics on actual database performance in order to find and fix intermittent problems.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

Just wanted to complement you guys on your outstanding website. Keep up the great work!

May 5, 2012 | Registered Commenterdbyu

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Textile formatting is allowed.