![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a web site which uses PostgreSQL as a host database and a background program which uses this database too. I want to change priority for database queries of this background program to "low" and change priority for web site database queries to "high". It is possible? |
#3
| |||
| |||
|
|
I want to change priority for database queries of this background program to "low" and change priority for web site database queries to "high". |
#4
| |||
| |||
|
|
I don't know how effective this would be, but you could wrap the system call setpriority() in a user-defined function if your platform supports it. This would set the "nice" value of the backend process, which might serve as a crude prioritization mechanism. |
#5
| |||
| |||
|
|
Michael Fuhr <mike (AT) fuhr (DOT) org> writes: I don't know how effective this would be, but you could wrap the system call setpriority() in a user-defined function if your platform supports it. Every couple of months someone comes along and says "why don't you provide a way to renice a backend" ... but in point of fact it's somewhere between useless and counterproductive for most query loads. |
#6
| |||
| |||
|
|
Michael Fuhr <mike (AT) fuhr (DOT) org> writes: I don't know how effective this would be, but you could wrap the system call setpriority() in a user-defined function if your platform supports it. This would set the "nice" value of the backend process, which might serve as a crude prioritization mechanism. Every couple of months someone comes along and says "why don't you provide a way to renice a backend" ... but in point of fact it's somewhere between useless and counterproductive for most query loads. The "useless" part comes in because nice only affects CPU priority not I/O priority, but I/O load is the thing that counts for most database applications. The "counterproductive" part comes in because of an effect called priority inversion. The niced-down process may be holding a lock that is wanted by some higher-priority process --- but the kernel scheduler knows nothing of that, and will leave the niced-down process at the bottom of the queue, and thus the high-priority process is effectively stuck at the bottom too. |
#7
| |||
| |||
|
|
I feel that renice a backend will not kill your system. |
#8
| |||
| |||
|
|
Gaetano Mendola <mendola (AT) bigfoot (DOT) com> writes: I feel that renice a backend will not kill your system. It won't kill the system, but it probably won't accomplish what you hoped for, either. |
#9
| |||
| |||
|
|
Tom Lane wrote: Gaetano Mendola <mendola (AT) bigfoot (DOT) com> writes: I feel that renice a backend will not kill your system. It won't kill the system, but it probably won't accomplish what you hoped for, either. That's true but right now renice a backend is the only way to procede in order to *try* to "slow down" some queries Regards Gaetano Mendola |
#10
| |||
| |||
|
|
Thats fine, but you do understand that nice (linux) will have *no* effect on I/O? |
|
For any non-trivial table (that can't be held entirely in memory), re-nice will almost certainly have no effect. |
![]() |
| Thread Tools | |
| Display Modes | |
| |