From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Assad Jarrahian <jarraa(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: an efficient way of checking if the connection to a db |
Date: | 2005-12-15 22:41:23 |
Message-ID: | Pine.BSO.4.61.0512151731120.4830@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Thu, 15 Dec 2005, Tom Lane wrote:
> It probably is. However, sending an empty query string to the backend
> to execute ought to be competitive with a bare Sync. libpq supports
> that; does JDBC?
You can say Statement.execute(""), but that still does the full extended
query protocol setup:
14:25:48.375 (1) FE=> Parse(stmt=null,query="",oids={})
14:25:48.377 (1) FE=> Bind(stmt=null,portal=null)
14:25:48.378 (1) FE=> Describe(portal=null)
14:25:48.378 (1) FE=> Execute(portal=null,limit=0)
14:25:48.378 (1) FE=> Sync
14:25:48.379 (1) <=BE ParseComplete [null]
14:25:48.380 (1) <=BE BindComplete [null]
14:25:48.380 (1) <=BE NoData
14:25:48.380 (1) <=BE EmptyQuery
14:25:48.381 (1) <=BE ReadyForQuery(I)
Testing this with the V2 protocol reveals an issue, but it looks like
the server's fault.
14:33:42.550 (1) FE=> Query("")
14:33:42.550 (1) <=BE EmptyQuery
At this point the driver is waiting for ReadyForQuery, but the server is
waiting for another query. The documentation states, "If a completely
empty (no contents other than whitespace) query string is received, the
response is EmptyQueryResponse followed by ReadyForQuery."
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-12-15 22:54:21 | Re: an efficient way of checking if the connection to a db |
Previous Message | Tom Lane | 2005-12-15 22:24:20 | Re: an efficient way of checking if the connection to a db |