Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D8F79632DBC; Sat, 6 Feb 2010 08:04:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71736-04; Sat, 6 Feb 2010 12:04:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id 5A9E0632B43; Sat, 6 Feb 2010 08:04:09 -0400 (AST) Received: from alap2.localnet (e178227112.adsl.alicedsl.de [85.178.227.112]) by mail.anarazel.de (Postfix) with ESMTPSA id 30404448007; Sat, 6 Feb 2010 13:04:05 +0100 (CET) From: Andres Freund To: Greg Smith Subject: Re: [HACKERS] Re: Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb) Date: Sat, 6 Feb 2010 13:03:50 +0100 User-Agent: KMail/1.13.0 (Linux/2.6.33-rc5-andres-00243-g6ea299e; KDE/4.3.95; x86_64; ; ) Cc: Robert Haas , Greg Stark , Tom Lane , pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org, Michael Clemmons , Hannu Krosing , Scott Marlowe References: <4427a97a0912101235x3ade510blcc00d5ce9883c6b6@mail.gmail.com> <4B698605.50506@anarazel.de> <4B6CF822.9010608@2ndquadrant.com> In-Reply-To: <4B6CF822.9010608@2ndquadrant.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201002061304.01682.andres@anarazel.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/107 X-Sequence-Number: 37528 On Saturday 06 February 2010 06:03:30 Greg Smith wrote: > Andres Freund wrote: > > On 02/03/10 14:42, Robert Haas wrote: > >> Well, maybe we should start with a discussion of what kernel calls > >> you're aware of on different platforms and then we could try to put an > >> API around it. > > > > In linux there is sync_file_range. On newer Posixish systems one can > > emulate that with mmap() and msync() (in batches obviously). > > > > No idea about windows. > The effective_io_concurrency feature had proof of concept test programs > that worked using AIO, but actually following through on that > implementation would require a major restructuring of how the database > interacts with the OS in terms of reads and writes of blocks. It looks > to me like doing something similar to sync_file_range on Windows would > be similarly difficult. Looking a bit arround it seems one could achieve something approximediately similar to pg_prepare_fsync() by using CreateFileMapping && MapViewOfFile && FlushViewOfFile If I understand it correctly that will flush, but not wait. Unfortunately you cant event make it wait, so its not possible to implement sync_file_range or similar fully. Andres