1

I want to connect a Postgres database with pooling:true. Can we do it with PHP new PDO option? If not are there any reliable options?

I want to pass the below parameters(similar) while establishing the connection:

Pooling=true;Minimum Pool Size = 2;Internal Command Timeout = 0;Command Timeout = 0;

I cannot find any such details in https://www.php.net/manual/en/ref.pdo-pgsql.connection.php

Any help will be much appreciated.

chithra
  • 756
  • 7
  • 12

2 Answers2

1

As far as i remember from old days of programming in PHP, You cannot have pooling in PHP as php is not threded (most of times) and each requests goes line by line. In JavaScript (node.js) you can do pooling, but not on PHP as each request is one thread.

Seti
  • 2,169
  • 16
  • 26
0

We can use PgBouncer. This has been answered in another question.

K M
  • 196
  • 3
  • 9
  • 1
    You still dont have pooling in PHP, you connect to totally different server and that server uses pooling itself, but PHP do not have pooling anyway – Seti Jun 22 '22 at 22:01