bigfunctions
bigfunctions copied to clipboard
[new]: `sleep(time ms)`
Check the idea has not already been suggested
- [X] I could not find my idea in existing issues
Edit the title above with self-explanatory function name and argument names
- [X] The function name and the argument names I entered in the title above seems self explanatory to me.
BigFunction Description as it would appear in the documentation
Returns NULL after input time (ms)
Examples of (arguments, expected output) as they would appear in the documentation
- sleep(1000) --> Returns NULL after 1 seconds
- sleep(60000) --> Returns NULL after 60 seconds
Hi 👋,
Can you add some more background to this function? i.e.
- What's the significance of adding a delay in query execution?
- What use cases you're thinking of for using this
sleep?
This function was added in décember 2023 :
bigfunctions.eu.sleep(10)
where sleep function get's seconds in param (not ms) i guess it covers this current need ?!
@shivam221098, example of use case :
- propagating descriptions on columns from an other query ...
where you can only do 5 DDL per 10 seconds !
example :
DECLARE i INT64 DEFAULT 5;
FOR sql_alter_descr in (/* {select generating DDL alter table column set options descriptions commands } */)
DO
execute immediate sql_alter_descr.sql;
SET i = i + 1;
IF (i>=5) THEN
-- sleep of 10s every 5 DDL edits on a table
CALL bigfunctions.eu.sleep(10);
SET i = 0;
END IF;
END FOR;
@AntoineGiraud That's great. That made sense.