Subject i need your opinion...
Author Ali Gökçen
Hi FB folk,
i did some bull shit and i want to hear your opinions please..

yesterday evening when i work with my boss(also our app programmer)
we sense again FB runs queries too much fast!
we said:
"oh damn! we need to slow down some of this queries with minimum
cost"
so i did think for little time, and found a way to do it.

create generator DELAY_ELECTRICAL_ENGINE;
set generator DELAY_ELECTRICAL_ENGINE to 1000;

create generator DELAY_GASOLINE_ENGINE
set generator DELAY_GASOLINE_ENGINE to 5000;

create generator DELAY_DIESEL_ENGINE
set generator DELAY_DIESEL_ENGINE to 10000;

create procedure electrical_engine
returns(SPIN int)
as
begin
SPIN=gen_id(DELAY_ELECTRICAL_ENGINE,0);
WHILE(SPIN>0) DO SPIN=SPIN-1;
SUSPEND;
end

recreate procedure gasoline_engine
returns(SPIN int)
as
begin
SPIN=gen_id(DELAY_GASOLINE_ENGINE,0);
WHILE(SPIN>0) DO SPIN=SPIN-1;
SUSPEND;
end

create procedure diesel_engine
returns(SPIN int)
as
begin
SPIN=gen_id(DELAY_DIESEL_ENGINE,0);
WHILE(SPIN>0) DO SPIN=SPIN-1;
SUSPEND;
end


select * from mylargetable -- works at lowest priority
join diesel_engine on 1=1;
where blahblah

select * from mylargetable -- works at low priority
join gasoline_engine on 1=1;
where blahblah

select * from mylargetable -- works at medium priority
join electrical_engine on 1=1;
where blahblah

select * from mylargetable -- works at light speed
where blahblah


I know this is not ideal, but better than nothing.
Are there anyone knows better way to set query priorites without
IO cost?
To OS gurus, is there a command to leave a thread, instead of
delay via counting? (we can write an UDF to call this command)
(I know i am too lazy about to take a look WIN32 API guide)

Regards.
Ali