X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E68F35287A for ; Wed, 1 Jun 2005 16:13:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37525-02 for ; Wed, 1 Jun 2005 19:13:43 +0000 (GMT) Received: from rhino.esc1.com (hh1098003.direcpc.com [206.71.98.3]) by svr1.postgresql.org (Postfix) with ESMTP id C232A52872 for ; Wed, 1 Jun 2005 16:13:35 -0300 (ADT) Received: from rhino.esc1.com (localhost.localdomain [127.0.0.1]) by rhino.esc1.com (8.12.11/8.12.10) with ESMTP id j51JAAjW029254 for ; Wed, 1 Jun 2005 15:10:10 -0400 Received: from localhost (localhost [[UNIX: localhost]]) by rhino.esc1.com (8.12.11/8.12.11/Submit) id j51JAAWu029252 for pgsql-interfaces@postgresql.org; Wed, 1 Jun 2005 15:10:10 -0400 From: Terry Lee Tucker Organization: Enhanced Solutions Computing To: PostgreSQL Interfaces Subject: Re: libpq, blocking/nonblocking mechanism Date: Wed, 1 Jun 2005 15:10:10 -0400 User-Agent: KMail/1.5.3 References: <7104a737050528133410045f04@mail.gmail.com> <200505310651.54505.terry@esc1.com> <7104a7370506011118270bf58f@mail.gmail.com> In-Reply-To: <7104a7370506011118270bf58f@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200506011510.10371.terry@esc1.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/2 X-Sequence-Number: 5570 On Wednesday 01 June 2005 02:18 pm, Volkan YAZICI saith: > Hi, > > On 5/31/05, Terry Lee Tucker wrote: > [snipped] > > > I'm looking at the documentation in: > > file:/usr/share/doc/postgresql-7.4.6/html/libpq-async.html > > on my machine. > > Thanks so much, but I'm able to read manuals too. =46rom your original message: "P.S. Documentation pointers will be accepted with pleasure too." > I'm trying to don't > carry my questions here until I finish a satisfying > postgresql.org/docs plus google.com search. Namely, I read that lines > nearly I hundred times. > > I advice you to looking at my question twice. PQsetnonblocking () causes PQsendQuery to send an sql string to the backend= =20 and it returns immediately if you have set nonblocking to true. If you have= =20 not set nonblocking to true, then PQsendQuery behaves just like PQexec; it= =20 blocks, i.e., it waits for the query, update, delete, or whatever to comple= te=20 before it returns program control back to your program. We set nonblocking = to=20 True in our application and when the user queries a large table that could= =20 return thousands of records, we use PQsendQuery instead of PQexec; however,= =20 if you do that, then you have to use PQconsumeInput and PQisBusy in=20 conjunction with a select statement to monitor the backend connection socke= t=20 so you can process the results when the query finishes. Another reason for= =20 using asynchronous queries is that you can provide a mechanism for the user= =20 to cancel the operation. Our application is X-Windows based written in C.= =20 All my examples are C. If you want to see any of it, you can let me know. > > Regards. > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match