Configuration & env flags
Environment variables
Section titled “Environment variables”| Variable | Default | Effect |
|---|---|---|
IFX_BUFFERED_READER | 1 | Enable connection-scoped read buffer (Phase 39). Set to 0 to disable. |
IFX_DEBUG_WIRE | unset | When set to a truthy value, log wire-level PDU framing to stderr. Verbose; for debugging only. |
IFX_PROTOCOL_TRACE | unset | When set to a path, write annotated wire captures to the file. |
IFX_DISABLE_PIPELINE | unset | Disables pipelined executemany (Phase 33). Use only to A/B-measure. |
INFORMIXSERVER | (none) | Read by connect() if server= is not provided. |
Environment variables are read at connection construction. Changing them at runtime doesn’t affect existing connections.
Connection arguments
Section titled “Connection arguments”Full keyword list for informix_db.connect():
| Arg | Type | Default | Notes |
|---|---|---|---|
host | str | required | TCP host. |
port | int | 9088 | TCP port. 9089 is the typical TLS listener. |
user | str | required | |
password | str | required | |
database | str | None | required | None logs in without selecting a DB. |
server | str | required | DBSERVERNAME, not hostname. |
autocommit | bool | False | |
connect_timeout | float | None | None | TCP+login timeout. |
read_timeout | float | None | None | Per-read timeout. |
keepalive | bool | False | SO_KEEPALIVE. |
client_locale | str | "en_US.8859-1" | See SQL ↔ Python types for codec mapping. |
env | dict[str, str] | None | None | Server-side session env. |
tls | bool | ssl.SSLContext | False | See Connect with TLS. |
row_factory | type | None | None | informix_db.Row for name and attribute access. See Rows. |
fetch_buffer_size | int | 0 | Bytes per fetch. 0 derives it from the row width. See below. |
fetch_buffer_size
Section titled “fetch_buffer_size”Leave it at 0 unless you are fetching a lot of rows. The driver then
sizes each fetch from the result set’s own row width, which is the
figure the server reports in its DESCRIBE response.
Raising it trades memory for round-trips. Measured on a 50,000-row eight-column fetch:
| Budget | Round-trips | Time |
|---|---|---|
0 (4096 for this shape) | 563 | 331 ms |
| 16 KiB | 142 | 271 ms |
| 64 KiB | 37 | 264 ms |
About 1.25x, with the knee between 16 and 64 KiB and nothing useful above it. A value below one row is raised to the row width, since a budget under one tuple cannot fetch anything.
Pool tunables
Section titled “Pool tunables”| Arg | Default | Effect |
|---|---|---|
min_size | 1 | Connections to pre-warm at create time. |
max_size | 10 | Hard cap. |
acquire_timeout | 30.0 | Raise PoolTimeout after this many seconds. |
max_idle | 600.0 | Close connections idle longer than this (seconds). |
health_check | True | Validate idle connections before returning from the pool. |
All other connection arguments are forwarded to each pool-created connection.
Server-side session env
Section titled “Server-side session env”The env={} parameter of connect() sets server session variables sent in the login PDU:
informix_db.connect( ..., env={ "OPT_GOAL": "-1", # optimize for first-row return "OPTOFC": "1", # auto-free cursors at fetch-close "IFX_AUTOFREE": "1", },)CLIENT_LOCALE is set automatically from client_locale=, so don’t put it in env=.