Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 166C2200B0F for ; Fri, 17 Jun 2016 12:26:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 14F78160A61; Fri, 17 Jun 2016 10:26:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5DC02160A50 for ; Fri, 17 Jun 2016 12:26:40 +0200 (CEST) Received: (qmail 60309 invoked by uid 500); 17 Jun 2016 10:26:39 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 60297 invoked by uid 99); 17 Jun 2016 10:26:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jun 2016 10:26:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B2347180501 for ; Fri, 17 Jun 2016 10:26:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id IkO-5YxNyWRy for ; Fri, 17 Jun 2016 10:26:36 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id BC4595F1B3 for ; Fri, 17 Jun 2016 10:26:35 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id w5so110722316oib.2 for ; Fri, 17 Jun 2016 03:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=B/Mlllym0Vv1cgJWjGZtA+sedyvv03O6ooKn9PpWstU=; b=APDA3yeUTeoqkiBf1zOTI4Few8Lkp/8uxkcIRluAxW2n4M+TXBnf7odJX5GfcARmVL nMZKdLgBCXWHXoItQrCQHexpSSdKoQRJM3/7C4J1hE9FxplUx89rnSQ3gXHCPUhSMNi5 SX0ioAQ0wNG9DKZ3eqxduhHL1XUy8Q7+WQ8og/GGy0sSLuXzmGBOuvwCgoqSiS3FU8KJ k8Gs4xHizgaXDfccm7SmR5u1656KuQJ3dVi4/wQTzPMTyDjt3sYb2hq76B2pjv/JEMwU twd/0Tslq92GkCj2cJJvdkTvRvLuBTwD5bcisF7/6dpyOSmhxV8wvHG/an2QK7MLHAfj O9Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=B/Mlllym0Vv1cgJWjGZtA+sedyvv03O6ooKn9PpWstU=; b=k66wo9RD3tfiIXDvz4V+yp2SjaBZfKO0s6yhWIsw/iaSC3J7wcSXHcmQOVdDT0Rb+5 k8EcTGrAoS0uw0BkjxxoivZqJ0mhjNRR/7PAL/weRahy4YCQeHbZIeMBkYtcqtrbuG1/ crCni/WuHtBjmweFR3HfZh/5Boxw2hZb0kvMJ5TxdqIAU6YTAmHV22U+bpqwSOAkBSPB Ed4h3uw9Ued8vFitZvHs37Np0xfLMN4tN5/GecQNwPXpOadDBhhN9Byq3XyULdyV5xlN MfbMNyzQsGHJS3IYRuChoIkQdrqkvTh05NSLgaSohnu822Geag2J0uiXCfREv2mXultQ qxKQ== X-Gm-Message-State: ALyK8tJd0lUlkD4622XL80essgozmUOFr19M8Itx1OwTzYY3kaHvtCLa0cZkqntojt6e2OR5o8FMIjV7rq9nTw== X-Received: by 10.157.40.2 with SMTP id m2mr816525otb.99.1466159194556; Fri, 17 Jun 2016 03:26:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.192.137 with HTTP; Fri, 17 Jun 2016 03:26:33 -0700 (PDT) In-Reply-To: References: From: Stefan Klein Date: Fri, 17 Jun 2016 12:26:33 +0200 Message-ID: Subject: Re: Keep the constant size of database To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=001a113d0c86f9ce6f053576c99b archived-at: Fri, 17 Jun 2016 10:26:41 -0000 --001a113d0c86f9ce6f053576c99b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, 2016-06-17 11:26 GMT+02:00 Anatoly Smolyaninov : > Hello! > > I=E2=80=99m gathering lots of data with couchdb for statistics. Map-reduc= e view > approch gives the ability to quickly get pre-calculated data, and this is > very handy since the data consumer software wants the data quickly and ve= ry > often in spite of very high speed of new incoming stat metrics. > > But I=E2=80=99m having troubles keeping the database always the same size= : I need > only data for e.g. last 3 hours and all which is elder to be deleted. > > I have a special view which emits the timestamp. I query that view with > startkey-endkey params equal 3 hours ago and then bulk_update this items > back with _deleted field. But what I'm currently see is that when I do > delete this way & cleanup after that operation, the number of documents i= s > reduced as I expected but size of db has actually increased. > > So, after some time of this constant auto clean-up, I see that size of > database increased very much, but number of documents remains constant. > > It would be kind of tricky to create a few databases and delete it > completely, because data is constantly coming with a high rate. Another > words, I always need that 3 hour history. > > Where can I read how this mechanism actually works and how should I delet= e > the data properly? Is it actually possible? > You got 2 possibilities and probably want to use both. First is compaction. Manual: http://docs.couchdb.org/en/1.6.1/api/database/compact.html Automatic: http://docs.couchdb.org/en/1.6.1/config/compaction.html This will still leave the deleted documents (not their body) in the DB, so your db size will still slightly increase over time. To solve this, you would have to create a new DB, replicate the still needed data to this new db without replicating the deleted document. So either a filter function to not replicate the deleted or in your case even just documents younger than 3 hours. Be aware, views are not replicated, so the initial view access will take longer. regards, Stefan --001a113d0c86f9ce6f053576c99b--