Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E6AFFB26043 for ; Fri, 11 Nov 2011 18:21:26 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 35729-10 for ; Fri, 11 Nov 2011 22:21:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from smtp2.peak6.com (smtp2.peak6.com [38.98.137.9]) by mail.postgresql.org (Postfix) with ESMTP id 8AED9B26042 for ; Fri, 11 Nov 2011 18:21:20 -0400 (AST) X-AuditID: 0a02cb1e-b7c9dae000007b76-62-4ebd9fe168ac Message-ID: <4EBD9FDE.4000104@peak6.com> Date: Fri, 11 Nov 2011 16:21:18 -0600 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Using incrond for archiving Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.220.61] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsXCxcQroftw/l4/g+c3zS2uzzzH7MDocWHf NPYAxqgGRpvEvLz8ksSSVIWU1OJkW6UAV0dvMwWXzOLknMTM3NQiJYXMFFslMyWFgpzE5NTc 1LwSW6XEgoLUvBQlOy4FDGADVJaZp5Cal5yfkpmXbqvkGeyva2FhaqlrqGQXjwUkNLFkfLzf xVawnLvi0tHvLA2M/zi6GDk4JARMJF7eEuti5AQyxSQu3FvPBmLzCmhItCw5wAxSwiKgKjH3 kBZImE1ATWLh7puMILaQgKzE/lXnWEFsfgFhiX0fmphBbFGBEIlnE55DjRGUODnzCQuILSLg KTF7/zYwW1hAReLnvAVMIDazgK3EhTnXWSBseYntb+cwQ8yXk7jTADIH5EoFievL/Scw8s9C MnUWku5ZSLoXMDKvYhQvLktMzsg0KyjOLSkw1CtITcw208tLLdnECI6r03I7GFdcUDzEKMDB qMTDuyBpr58Qa2JZcWXuIUYJDmYlEd7OuUAh3pTEyqrUovz4otKc1OJDjKbA0JjILCWanA+M +bySeENjQ0tTS2MzAyMTSwslcd6vz7b5CQmkA+M5OzW1ILUIpo+Jg1OqgXFz56Q7vVmrO2Or ba3Krl+PKOpKklsR+KSvyyLh4LFTXk8vHl9Q4bx024ug2oblj+6ctJsVffPZevnTC49t5XTd w+XodfmbZXtzsnpgmXrzlUNGezITVxzMCW37dDF4yR8NqTd7J39gLis72LXfqK3nvHpD1PWC 0qJVQZ5qqo9Kw103bZhTy6DEUpyRaKjFXFScCACsS9A1wQIAAA== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.101 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.201 X-Spam-Level: X-Archive-Number: 201111/147 X-Sequence-Number: 45658 Hey guys, I've been running some tests while setting up some tiered storage, and I noticed something. Even having an empty 'echo' as archive_command drastically slows down certain operations. For instance: => ALTER TABLE foo SET TABLESPACE slow_tier; ALTER TABLE Time: 3969.962 ms When I set archive_command to anything: => ALTER TABLE foo SET TABLESPACE slow_tier; ALTER TABLE Time: 11969.962 ms I'm guessing it has something to do with the forking code, but I haven't dug into it very deeply yet. I remembered seeing incrond as a way to grab file triggers, and did some tests with an incrontab of this: /db/wal/ IN_CLOSE_WRITE cp -a $@/$# /db/archive/$# Sure enough, files don't appear there until PG closes them after writing. The background writing also doesn't appear to affect speed of my test command. So my real question: is this safe? Supposedly the trigger only gets activated when the xlog file is closed, which only the PG daemon should be doing. I was only testing, so I didn't add a 'test -f' command to prevent overwriting existing archives, but I figured... why bother if there's no future there? I'd say tripling the latency for some database writes is a pretty significant difference, though. I'll defer to the experts in case this is sketchy. :) -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604 312-676-8870 sthomas@peak6.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email