Subject Re: 1.5.3 SS: need to run long-running queries with low prio - how?
Author Ali Gökçen
Hi Kjell,

1- you can write an SP and put some command that makes CPU busy.

for example:

loop:
fetch row
while somecondition do dummycpuALUcalculation
insert row
continue


Note: create your index when you create your table, not after bulk
insert becuase of index building will does natural scan at crazy
speed. This causes DISK I/O bottleneck and increases respons time of
server to users. Yup, your bulk insert will be more slow, but as you
know there is only one timeline and we must to share it with
balanced.


2- you can write a dummy UDF to do sleep-pill effect for releated
thread, with low level system(win32) api calls.

Ali

--- In firebird-support@yahoogroups.com, Kjell Rilbe
<kjell.rilbe@...> wrote:
>
> Hi,
>
> I've got a production database in FB 1.5.3. It contains about 1
million
> records in one table. These are fetched from an external source
that's
> updated every two weeks. After each external update I need to
update my
> production table. For this purpose I actually have two production
tables
> and use the following process:
>
> 1. Production system uses table 1.
>
> 2. Drop table 2 and recreate it.
>
> 3. Fill table 2 using three long-running queries (about 1 hour in
total).
>
> 4. Index table 2. Takes about half an hour.
>
> 5. Switch production system to use table 2.
>
> I need the process in steps 2-4 to run with low priority to make
sure
> the production system is not impaired - this is a web application
and
> requires good response times.
>
> What is the best way to achieve this? It would be possible to
switch to
> classic, if that's any help. The server that hosts both DB, web
server
> and web application has 1 Gbyte RAM, and a single harddisk
(actually a
> mirrored pair). Windows 2003 server.
>
> Thanks,
> Kjell
> --
> --------------------------------------
> Kjell Rilbe
> Adressmarknaden AM AB
> E-post: kjell.rilbe@...
> Telefon: 08-761 06 55
> Mobil: 0733-44 24 64
>