Sagewire Logo

The Big Sleep

4 Message(s) by 3 Author(s) originally posted in mysql discussion


From: strawberry Date:   Saturday, October 20, 2007
Just curious, is this expected behaviour?:

mysql> SELECT GREATEST(SLEEP(3),SLEEP(4));
+-----------------------------+
| GREATEST(SLEEP(3),SLEEP(4)) |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set (8.71 sec)


From: Paul Lautman Date:   Saturday, October 20, 2007
wrote in message:
Just curious, is this expected behaviour?:
mysql> SELECT GREATEST(SLEEP(3),SLEEP(4));
+-----------------------------+
GREATEST(SLEEP(3),SLEEP(4)) |
+-----------------------------+
0 |
+-----------------------------+
1 row in set (8.71 sec)



I guess it depends on what can "interrupt" SLEEP?

I'd expect
SELECT GREATEST(LOUD_SNORE(),SLEEP(4));
to return 1


From: J.O. Aho Date:   Saturday, October 20, 2007
wrote in message:
wrote in message:
Just curious, is this expected behaviour?:

mysql> SELECT GREATEST(SLEEP(3),SLEEP(4));
+-----------------------------+
GREATEST(SLEEP(3),SLEEP(4)) |
+-----------------------------+
0 |
+-----------------------------+
1 row in set (8.71 sec)
I guess it depends on what can "interrupt" SLEEP?
I'd expect
SELECT GREATEST(LOUD_SNORE(),SLEEP(4));
to return 1


From the online manual
http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-function s.html#function_sleep

SLEEP(duration)

Sleeps (pauses) for the number of seconds given by the duration argument, then
returns 0. If SLEEP() is interrupted, it returns 1. The duration may have a
fractional part given in microseconds. This function was added in MySQL 5.0.12.

So, the results seems to be right.

--

//Aho


From: J.O. Aho Date:   Saturday, October 20, 2007
wrote in message:
Just curious, is this expected behaviour?:
mysql> SELECT GREATEST(SLEEP(3),SLEEP(4));
+-----------------------------+
| GREATEST(SLEEP(3),SLEEP(4)) |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set (8.71 sec)


Greatest can not guess the value that a function returns, it has to wait and see
what happens, so it first waits 3 seconds for the first sleep to finish, and
then 4 seconds for the second sleep to finish, none of the sleep functions
will be interrupted (without outer interference) and therefore you get 0.

I think you'd see the pattern if you change the sleep values on a mysql
server that runs on a low load machine.

--

//Aho



Next Message: comparing db job markets


Blogs related to The Big Sleep

How can i ecommerce use Dejavu Mono font on urxvt I tried to use ...
in meniconfig i have a simple Q….say you are in a pretty big catagory like networking (which i am) and you start checking things on either M or * and you are going down the options 1 by 1…..why is it sometimes when you check some ...

How to Write an Intelligent-Sounding Stupid Job Ad
“Standards-compliant” can modify both “HTML” and “CSS” and maybe even “Javascript” (but then you’d call it ECMAScript) but not really “Perl, PHP, and MySQL.” But the odds of someone being both a skilled Solaris administrator and an ...

quotes mysql
quotes mysql quotes naked quotes name quotes name calling quotes names quotes names msn quotes napoleon quotes napoleon bonaparte quotes napoleon dynamite quotes napoleon dynamite liger quotes napoleon dynamite skills quotes napoleon ...

drop skank stop
... oracle drop table if exists drop table if exists access drop table if exists in oracle drop table if exists mysql drop table if exists oracle drop table if exists oracle sql drop table if exists plsql drop table if exists postgres ...

li by default j2ee is 100% of the viewport Id like to underline a ...
It will store it in sqlite There will be an .sql file in your profile directory, I believe I think they’re going to have it automatically save an .html version as well for transitional purposes, but it will primarily work with the Mysql ...

kawaly zydowskie
my big sleep memory foam pillows karaoke revolution volume 4 song muslin baby name mr rahman musica gratis bachata multi channel system mr chu hull music midtown festival 2005 music greeting card email h rblock tax return kaleigh peters ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional