Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4EE4E1829E for ; Mon, 30 Nov 2015 07:48:12 +0000 (UTC) Received: (qmail 39438 invoked by uid 500); 30 Nov 2015 07:48:09 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 39373 invoked by uid 500); 30 Nov 2015 07:48:09 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 39361 invoked by uid 99); 30 Nov 2015 07:48:08 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2015 07:48:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 5313C1A078D for ; Mon, 30 Nov 2015 07:48:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.63 X-Spam-Level: *** X-Spam-Status: No, score=3.63 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, KAM_INFOUSMEBIZ=0.75, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id SjEOoVESojgl for ; Mon, 30 Nov 2015 07:47:57 +0000 (UTC) Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com [209.85.160.174]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id C72BC234A5 for ; Mon, 30 Nov 2015 07:47:50 +0000 (UTC) Received: by ykdr82 with SMTP id r82so173910353ykd.3 for ; Sun, 29 Nov 2015 23:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=UiU5XwQ+6QV8AtfJ6nuTUq575w2G7xWaUCfuapfMOc8=; b=FV0qno9IAGV3uqNZUChi0sUI4CuGrZoYeoX0DWa+IESUdiENR7F1C8gvMjoLpOc/R9 JxiAMHYc2dodawU4XNpBEt5X37drCuU5nsf0F3xovyUwgUsk+t6YkSe+afzX7tEn5pu2 lSAgWLFDDy+ybt2ZWUXb6OHCC2HFG0eE+3x86BSajHeuvDCsepl1FhgMoQT9QX98S7NR ePbiW/AxR5f3BtVa8l+lyUQR3Y3LvKD9Y5T0QowsYYvaHSgVfJV/n1X9fLAFIC3TL55A 5EDuq8Sfnyd9f/p9FK4HfGehz8mX7uOA8xTlFE2eteVP5ASjsHUjgvAO/ecDEh7sQb84 1phw== MIME-Version: 1.0 X-Received: by 10.129.74.212 with SMTP id x203mr57341512ywa.69.1448869669969; Sun, 29 Nov 2015 23:47:49 -0800 (PST) Received: by 10.129.78.11 with HTTP; Sun, 29 Nov 2015 23:47:49 -0800 (PST) In-Reply-To: References: Date: Mon, 30 Nov 2015 08:47:49 +0100 Message-ID: Subject: Re: Rowkey design From: Marko Dinic To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=001a114d79780128c30525bd42f8 --001a114d79780128c30525bd42f8 Content-Type: text/plain; charset=UTF-8 Hi Tariq, Thank you for your answer. But won't that break the ordering of my rows by timestamp thus making it impossible to scan by time range using STARTROW ENDROW? Best regards, Marko On Monday, November 30, 2015, Mohammad Tariq wrote: > Hi Marko, > > You could add the place(and unit as well) to your key if that's not making > it very long. And then use RowFilter with SubstringComparator to get the > desired rows. > > > [image: http://] > Tariq, Mohammad > about.me/mti > [image: http://] > > > > On Mon, Nov 30, 2015 at 3:49 AM, Marko Dinic > wrote: > > > Hello, everyone! > > > > I'm new to HBase and I need help designing rowkeys for use case that > looks > > like this: > > > > - Products are listed, where each product has a product id. > > - Each product has a timestamp. > > - Each product is created in certain place (e.g. city) > > - Each product is created by some unit (e.g. factory) > > > > I would like to be able to scan products from a certain time period on > one > > hand, from a certain place, or from a certain unit. > > > > I read about salting to avoid hot-spotting and I understand that rows are > > sequential by rowkey. This will allow me to scan for a certain time > period > > using with following rowkey: > > > > salt-productId-timestamp > > > > And I can specify the period using STARTROW, ENDROW. > > > > What confuses me is how to include place (and maybe unit) into key and be > > able to select products from certain place during certain time period? > > > > If I limit myself to be able to scan by one of the above (time range OR > > place) I have an idea to duplicate data to two different tables, one with > > (salt-productId-timestamp) and other with (salt-productId-place) keys. Is > > that recommend or not? > > > > So, how to construct my keys? > > > > I should emphasize that i need this data to be input to MAPREDUCE JOB. > > > > Any help is greatly appreciated. > > > > -- > > Best regards, > > Marko > > > -- Marko Dinic --001a114d79780128c30525bd42f8--