PostgreSQL through ODBC: 400-500% slower than MS SQL, memory grows, and "Record changed by another station" (UseDeclareFetch, LFConversion)

Applies to: Clarion 6 (build 9053) with PostgreSQL 8.4, as reported in 2009; the ODBC driver version is not named.

Problem

A poster saw PostgreSQL about 400-500% slower than MS SQL 2008, locally and over the network on the default port, and asked for recommended ODBC driver switches and tips.

Solution

  1. Add UseDeclareFetch=1 to the connection string. The poster reported that without it Postgres read every table completely into memory, used more and more memory, then slowed down by swapping to disk.
  2. If "Record changed by another station..." appears all over the place, set LFConversion=0 (the poster's note: CR <> CRLF = False).
  3. Another poster used no switches and a plain string, and found it very fast: 'DRIVER=PostgreSQL ANSI;SERVER=' & Clip(GLO:Server) & ';PORT=5432;DATABASE=' & Clip(GLO:Database) & ';UID=...;PWD=...' He asked whether the primary keys and sequences are in place.
  4. Further reading named in the thread: Clarion Magazine tips by Dave H., and an earlier thread titled "OT: PostgreSQL performance tips" (about July 2009) in the same newsgroup.

Caveats

  • The poster generated auto-increment values on the client, not server-side; the thread does not say whether that affected speed.
  • One poster added that Postgres is also faster on a *nix server; this was not measured in the thread.
  • No timings after the changes were posted.

Today (2026)

The two connection-string options are still listed by current psqlODBC, as far as known; not re-tested here.

Sources: Trevor C. (Nov 2009, the question), Peter H., Sean H., L Jack W. (Nov 2009) in softvelocity.clarion.databasedrivers.