Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-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 5ACA8F0DA for ; Sat, 4 May 2013 18:31:49 +0000 (UTC) Received: (qmail 90747 invoked by uid 500); 4 May 2013 18:31:46 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 90720 invoked by uid 500); 4 May 2013 18:31:46 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 90712 invoked by uid 99); 4 May 2013 18:31:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 May 2013 18:31:46 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [72.35.23.38] (HELO smtp-out2.electric.net) (72.35.23.38) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 May 2013 18:31:41 +0000 Received: from 1UYhEZ-0007nF-V6 by bean.electric.net with emc1-ok (Exim 4.77) (envelope-from ) id 1UYhEZ-0007nO-W6 for user@cassandra.apache.org; Sat, 04 May 2013 11:30:59 -0700 Received: by emcmailer; Sat, 04 May 2013 11:30:59 -0700 Received: from [10.86.10.83] (helo=fuseout2c) by bean.electric.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77) (envelope-from ) id 1UYhEZ-0007nF-V6 for user@cassandra.apache.org; Sat, 04 May 2013 11:30:59 -0700 Received: from mailanyone.net by fuseout2c with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (MailAnyone extSMTP dbrosius@baybroadband.net) id 1UYhEW-0004z3-Sn for user@cassandra.apache.org; Sat, 04 May 2013 11:30:59 -0700 Message-ID: <518553CC.3000109@mebigfatguy.com> Date: Sat, 04 May 2013 14:30:36 -0400 From: Dave Brosius User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: user@cassandra.apache.org Subject: Re: Look table structuring advice References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Outbound-IP: 10.86.10.83 X-Env-From: dbrosius@mebigfatguy.com X-Virus-Checked: Checked by ClamAV on apache.org if you want to store all the roles in one row, you can do create table roles (synthetic_key int, name text, primary key(synthetic_key, name)) with compact storage when inserting roles, just use the same key insert into roles (synthetic_key, name) values (0, 'Programmer'); insert into roles (synthetic_key, name) values (0, 'Tester'); and use select * from roles where synthetic_key = 0; (or some arbitrary key value you decide to use) the that data is stored on one node (and its replicas) of course if the number of roles grows to be large, you lose most of the value in having a cluster. On 05/04/2013 12:09 PM, Jabbar Azam wrote: > Hello, > > I want to create a simple table holding user roles e.g. > > create table roles ( > name text, > primary key(name) > ); > > If I want to get a list of roles for some admin tool I can use the > following CQL3 > > select * from roles; > > When a new name is added it will be stored on a different host and > doing a select * is going to be inefficient because the table will be > stored across the cluster and each node will respond. The number of > roles may be less than or just greater than a dozen. I'm not sure if > I'm storing the roles correctly. > > > The other thing I'm thinking about is that when I've read the roles > once then I can cache them. > > Thanks > > Jabbar Azam