Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XVbgT-0004Kh-TO for pgsql-jdbc@arkaria.postgresql.org; Sun, 21 Sep 2014 07:35:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XVbgS-0006dC-Hx for pgsql-jdbc@arkaria.postgresql.org; Sun, 21 Sep 2014 07:35:48 +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 1XVbgQ-0006d3-Ik for pgsql-jdbc@postgresql.org; Sun, 21 Sep 2014 07:35:46 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XVbgM-0001pJ-Hr for pgsql-jdbc@postgresql.org; Sun, 21 Sep 2014 07:35:45 +0000 Received: from ayaki.localdomain (124-148-195-121.dyn.iinet.net.au [124.148.195.121]) by mrelayeu.kundenserver.de (node=mreue104) with ESMTP (Nemesis) id 0MQ5lz-1XQuaZ0VZT-005EO4; Sun, 21 Sep 2014 09:35:38 +0200 Message-ID: <541E7FC3.3000201@2ndquadrant.com> Date: Sun, 21 Sep 2014 15:35:31 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: "Lussier, Denis" , Dave Cramer CC: Enrico Olivelli - Diennea , "pgsql-jdbc@postgresql.org" Subject: Re: Disk buffering of resultsets References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:vN94F23VQomDsgDZ8UvBn9dLiStXn974xS8XwF1821L ncTxNNxKhXVCqm+E9FcfKjzJZjvfwqSFUvW8ahEFcj/sAssjyE eOv/Cw+JFHjMNMb59XI8F+qVfzgLyRk2HAj4Z9Ou8OcAJWYucw eLTO7r5H+R/oudOmTXOV5I8SeXAlolF8CUTegIx0HnTWWNXN4I uoYnOOtmAagkgxmpzQ643AzRNizIUEl6tspXZgNhIUm5MInt9L wzZrmumwuBPwyFVzkLA8ZKclAtAdtmAWUw6km9zWJokw6Z8WTZ kVjNT3WobczDf2LSO8t4AIOYHJMUvQeHwBVRJBkIEWPyPLFuHE NOmolmPmPakv+zZV1aFK/qNZ9ujrqcx2VPJW4mHXA X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On 09/21/2014 11:24 AM, Lussier, Denis wrote: > This does seem very worthwhile. Can someone please sketch out a > mini-design and see if it makes sense to the pgjdbc core? I'd be > willing to hack some code, but, I'd want the design to be pre-vetted. > > Here's my first quick strawman: > > 1.) Get the TEMP directory (may be OS specific). Actually, on second thought, if we're going to do this we'd be silly to restrict it to spilling to disk. What we should have is the ability to flush a resultset to non-memory storage that provides a given interface when it exceeds a given size. That non-memory storage might be disk, it might be Redis/memcached/EHCache/BigCache/BigMemory/GemFire .../ whatever. In fact, it's more likely to be one of those than it is to be a simple on-disk cache for people who care about performance and have big result sets. All we need from a resultset storage layer is the ability to: * Register a new result set with the storage * Append a tuple to the storage * Fetch a tuple from the storage * Reliably destroy all storage associated with a resultset when the resultset is closed, the JVM exits, or the JVM/host crash. For crash, this cleanup might be a clean sweep. * Copy an existing, possibly incomplete result set to a new storage location (e.g. copy an in-memory resultset to disk). * ... and do this in a manner that makes the storage location unpredictable and minimises risk of attacks that aren't already possible using reflection against in-memory result sets. An API like that is a good fit for K/V stores like Redis, as well as for Memcached, and for disk storage. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc