I have a PHP CLI script, that processes a csv file, inserting it's content to a table in Postgresql database. This is on an Ubuntu server. I use schedtool to control the affinity of the whole script. Schedtool is used to launch the script itself with the -e option. Unfortunately with htop I see that the database thread is spawned as a completely different thread and being not affected by the affinity options.
Is it possible to somehow make the database process inherit all affinity options from the spawner PHP script?
I have just found the answer -as I was reading some Postgresql example files for Ruby :).
My best choice would be to get the very exact PID of the Postgresql thread that is running the current script, with NOTIFY - LISTEN.
As [depesz] told Postgres uses only 1 core. With schedtool
I still can control on which core it runs and with cpulimit
I can control it further.