agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Noah Watkins <noahwatkins@gmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Using threads in FDW for read-ahead
Date: Tue, 10 Jun 2014 15:21:01 -0400
Message-ID: <3383.1402428061@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB2gnbUqOGZi4u8ohKGqFdvtqEz4F6LE5kedHRKJBHO7z3YdcA@mail.gmail.com>
References: <CAB2gnbUqOGZi4u8ohKGqFdvtqEz4F6LE5kedHRKJBHO7z3YdcA@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-interfaces>

Noah Watkins <noahwatkins@gmail.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <3383.1402428061@sss.pgh.pa.us>
Permalink:  ../3383.1402428061@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3383.1402428061@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, noahwatkins@gmail.com
  Subject: Re: Using threads in FDW for read-ahead
  In-Reply-To: <3383.1402428061@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox