Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WuRbY-0001SR-9S for pgsql-interfaces@arkaria.postgresql.org; Tue, 10 Jun 2014 19:21:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WuRbX-0004FP-Pa for pgsql-interfaces@arkaria.postgresql.org; Tue, 10 Jun 2014 19:21:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WuRbW-0004F8-Tb for pgsql-interfaces@postgresql.org; Tue, 10 Jun 2014 19:21:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WuRbT-0000uZ-E5 for pgsql-interfaces@postgresql.org; Tue, 10 Jun 2014 19:21:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s5AJL1fK003384; Tue, 10 Jun 2014 15:21:01 -0400 From: Tom Lane To: Noah Watkins cc: pgsql-interfaces@postgresql.org Subject: Re: Using threads in FDW for read-ahead In-reply-to: References: Comments: In-reply-to Noah Watkins message dated "Tue, 10 Jun 2014 12:10:22 -0700" Date: Tue, 10 Jun 2014 15:21:01 -0400 Message-ID: <3383.1402428061@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org Noah Watkins writes: > I have created a FDW for a storage backend and it is working well, and now > I would like to overlap processing with I/O by performing read-ahead. I > started by using a thread to do background I/O and this worked, but > problems started to arise when I tried to do predicate filtering in the > thread. > In particular, it seems as though `check_stack_depth` is built to assume a > single threaded environment (`stack_base_ptr` is global). That is not even the tip of the iceberg of what will break if you try to use multiple threads in a Postgres backend. It's not supported. You might possibly manage to not break things if you keep the extra threads sufficiently narrowly scoped --- which for starters would include no use of palloc nor elog. Executing query predicates is right out. regards, tom lane -- Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces