One trick you may not have seen yet is to use "top -c" to look at your system. With this parameter, you can see what each active Postgres process does.
Query plans are not cached in any way in the database outside prepared statements. Regardless if you do not reuse similar queries, it is unlikely that you can reduce the query time with prepared statements. You can even make it worse if it results in the optimizer getting less information to work with, because he prepares things before he finds out all the information about what he is going to do. 1000 characters are far from a short request, and if you do not have hundreds of connections at once, this is really unlikely to parse or query planning. These are probably locking problems, bad VACUUM procedures leading to bloated data that you need to look for to do any work (very easy to see on 8.1), slow restrictions, excessive indexes or a design that does not take into account the overhead of moving things around memory completely. Overhead is very low on the suspect list.
And if you have hundreds of connections, you should consider using a connection pool. The process of creating PostgreSQL is quite difficult, and it does not work on its own in this environment.
Shoot, you are using such an old version, even 8.1, that you can see the error; 8.1.4 is full of them. 8.1.19 is current, and even 8.3.5 is already some useful version updates for the current one). See Version Policy for details on why launching an older version is a greater risk than updating in almost any situation.
Greg smith
source share