X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03C9F9DC813 for ; Sat, 18 Mar 2006 15:09:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93627-02 for ; Sat, 18 Mar 2006 15:09:28 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by postgresql.org (Postfix) with ESMTP id E11A19DC819 for ; Sat, 18 Mar 2006 15:09:26 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so14040wra for ; Sat, 18 Mar 2006 11:09:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=CjdD5tdUdU0nOxd++xHnYClkvc+jFCpVxUvTuuummjUeBOrtw+CCG03ULk/UjBSwC2TZfCOgRqQuiL+8nZ39hvF1KWUNGjfM8DStC6QyeA3mzErnQ3DV7Hgmje92ZxtJfew6yLahg4OeRh1KL1SAWqgdbE29Ke8EMxaqT1g5XIM= Received: by 10.54.148.5 with SMTP id v5mr515930wrd; Sat, 18 Mar 2006 11:09:27 -0800 (PST) Received: from ?10.0.2.3? ( [200.62.104.37]) by mx.gmail.com with ESMTP id 14sm3718666wrl.2006.03.18.11.09.25; Sat, 18 Mar 2006 11:09:27 -0800 (PST) From: Kevin Brown To: "Florian G. Pflug" Subject: Re: Transactions Date: Sat, 18 Mar 2006 13:16:34 -0600 User-Agent: KMail/1.8.3 Cc: pgsql-general@postgresql.org References: <200603180020.01418.blargity@gmail.com> <200603181258.04019.blargity@gmail.com> <441C5861.9080005@phlo.org> In-Reply-To: <441C5861.9080005@phlo.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603181316.35089.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/817 X-Sequence-Number: 92682 On Saturday 18 March 2006 12:58, Florian G. Pflug wrote: > Kevin Brown wrote: > > So what you're saying is that my commits and rollbacks should be async, > > correct? > > No, you should always use _async(), and never, ever use query() or exec() > in a multi-threaded app. > > > I don't quite understand how a select can be an async call.... I need > > the data to proceed. If you're saying on my inserts, deletes, etc, then > > that I can understand. > > Don't be fooled by the word async()... It's still synchronous for the > thread that calls it - the _thread_ is blocked until the query is done, > and query_async() returns the result, just as query() does. The difference > is only for all _other_ threads. All other threads can continue to run > while the one thread waits for query results _only_ if the one thread > used query_async(). If it used query(), then you _whole_ interpreter is > blocked until the query is finished. OH. Thank you! :-) > The naming of these function is quite strange - I was fooled by this > myself, and so was whoever wrote the DBD-module for pg, because he used the > non-async functions too ;-) Yeah, I only want the thread to wait, and async sounds like asynchronous or something. :-) > To rephrase - you don't usually need to change anything in your program > when using query_async() instead of query(). It'll just work better ;-). Makes sense now. > greetings, Florian Pflug