A PostgreSQL driver for Elixir that uses the binary protocol for efficient data encoding and decoding.
Postgrex is a PostgreSQL database driver for the Elixir programming language that provides a robust interface for interacting with PostgreSQL databases. It enables Elixir applications to perform queries, manage transactions, and handle complex data types with high performance and reliability by leveraging PostgreSQL's binary protocol. The driver emphasizes correctness and extensibility, aligning with Elixir's functional programming ethos.
Elixir developers building applications that require efficient and reliable PostgreSQL database interactions, including those needing custom type handling or integration with the Ecto library. It is also suitable for developers working on systems requiring advanced PostgreSQL features like JSON support, arrays, or user-defined types.
Developers choose Postgrex for its performance through binary protocol support, automatic type conversion between PostgreSQL and Elixir data types, and extensible type system that allows custom extensions. Its integration with DBConnection for transactions and pooling, along with broad PostgreSQL compatibility, makes it a preferred choice over simpler or less feature-complete drivers.
PostgreSQL driver for Elixir
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses PostgreSQL's binary protocol for data encoding, reducing overhead compared to text-based protocols and improving performance, as stated in the README's key features.
Automatically decodes and encodes common PostgreSQL types like integers, dates, and UUIDs into Elixir values, simplifying data handling with built-in support.
Allows user-defined extensions for custom or unsupported PostgreSQL types, enabling flexibility for complex data types, demonstrated in the extensions directory.
Integrates with DBConnection for transactions, prepared queries, and connection pooling, ensuring reliable database interaction management.
Supports JSON via Jason with configurable alternatives, though recompilation is required for changes, offering adaptability in JSON handling.
OID types require explicit casting or integer handling instead of automatic text conversion, adding boilerplate code and potential errors, as noted in the README.
Older PgBouncer versions (pre-1.21.0) don't support named prepared statements, forcing unnamed queries that can impact performance or require extra configuration.
Changing the JSON library requires cleaning and recompiling Postgrex with mix deps.clean, which can disrupt development workflows and deployment processes.
Features like hstore are not supported on PostgreSQL 8.4, limiting compatibility for systems using very old database versions, as mentioned in the README.