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 04B57108AE for ; Tue, 1 Jul 2014 10:04:24 +0000 (UTC) Received: (qmail 8558 invoked by uid 500); 1 Jul 2014 10:04:15 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 8522 invoked by uid 500); 1 Jul 2014 10:04:15 -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 8512 invoked by uid 99); 1 Jul 2014 10:04:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jul 2014 10:04:15 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jens.rantil@tink.se designates 209.85.219.45 as permitted sender) Received: from [209.85.219.45] (HELO mail-oa0-f45.google.com) (209.85.219.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jul 2014 10:04:13 +0000 Received: by mail-oa0-f45.google.com with SMTP id o6so10191140oag.4 for ; Tue, 01 Jul 2014 03:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tink.se; s=tink; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=5E7YyKgiwDOlk205GaiZK6g3BTxUcqsEs2KE61BolL0=; b=VIiwEiYweHbNtbA3lSaZToth7dcCEcpLs9oPxGaZPXW4rTochHB3/99sE4x6JJQoKc 7yZF9WG8ScSLQcNxFI1idE14nJGhg/6QvSgxEg/mXEHSJBbcXCRx+xorxfsHxDtfx+BR 6tWoqQav9gzpibb6JlsmivGjkS/pB+Z9dWloQ= 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:content-type; bh=5E7YyKgiwDOlk205GaiZK6g3BTxUcqsEs2KE61BolL0=; b=GAe/QdCWnRwRjY+PNWrzyp0+GWFD2AK+g+pi/ksZ4/inkkb6b3//wiKeiebtc8NA68 5CrE5BAWYgneqB085NbSPstTZx4eNyXNs1GnITzvEVa+XNTCAaKZmJ9xWohFIkFVEDlT Lwv7fPLr6/CWPd3/abrC0GFHZUPCTkUkQeWucNPuujD3ZWp++3fNT7znzLfhFRIEHUQy GAEMy8bl69rgIuycLg2ZkbCrlzFQjV/JhaMKhnt1H8S90ysd4YR/YxhnrYf7nQUnSG6h UZd05tPsFfx4d6f4Qgb3EcB0G/JpMQgwMHOT6LEHNbK+cCZSFENuoyLyZHpFPsP8FMok N4Og== X-Gm-Message-State: ALoCoQn6+zsU0dgsRmkUE5KljcprWW7JSjK3948GYwkxKxhoYmXWnx/6P5YCRkshnWJ/hiPxyVIO X-Received: by 10.60.34.7 with SMTP id v7mr9049268oei.9.1404209028385; Tue, 01 Jul 2014 03:03:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.233.6 with HTTP; Tue, 1 Jul 2014 03:03:27 -0700 (PDT) In-Reply-To: References: From: Jens Rantil Date: Tue, 1 Jul 2014 12:03:27 +0200 Message-ID: Subject: Re: Primary key question To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=089e01294b1053e05a04fd1ee499 X-Virus-Checked: Checked by ClamAV on apache.org --089e01294b1053e05a04fd1ee499 Content-Type: text/plain; charset=UTF-8 Hi again, As a follow-up; if you have many `message_source_id`s you could also do: CREATE TABLE integration_time ( message_source_id uuid, traffic_data_type varchar, integration_period varchar, integration_time timestamp, PRIMARY KEY (message_source_id,traffic_data_type,integration_period) ); This might enable you to easier be able to query all traffic_data_types and integration_periods for a single message_source_id without having to do a heavy query across all of your cluster. You'll have the same uniqueness property but this might, depending on your application, make things more debuggable. The flip side is that your cluster could be slightly more unbalanced if each message_source_id has a varied number of `integration_time`s. Just an idea, Jens On Tue, Jul 1, 2014 at 8:37 AM, Wim Deblauwe wrote: > Hi, > > I have the following table: > > CREATE TABLE integration_time ( > message_source_id uuid, > traffic_data_type varchar, > integration_period varchar, > integration_time timestamp, > PRIMARY KEY ((message_source_id,traffic_data_type,integration_period)) > ); > > I want the combination of (message_source_id, traffic_data_type, > integration_period) to be unique. Is this the correct way to do it (with > the double brackets) ? > > This table will be relative small, it just stores the last time something > was done in the application for that unique combination of those 3 > parameters. Worst case there will be 30000 rows in that table and they will > always be fetched by quering on the 3 parameters at the same time. > > regards, > > Wim > --089e01294b1053e05a04fd1ee499 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi again,

As a follow-up; if you have m= any `message_source_id`s you could also do:

CREATE TABLE integrati= on_time (
message_source_i= d uuid,
tra= ffic_data_type varchar,
integration_period varchar,
integration_time timestamp,
PRIMARY KEY (message_source_id,traffic_da= ta_type,integration_period)
);

This might enable you to= easier be able to query all traffic_data_types and integration_periods for= a single message_source_id without having to do a heavy query across all o= f your cluster. You'll have the same uniqueness property but this might= , depending on your application, make things more debuggable. The flip side= is that your cluster could be slightly more unbalanced if each message_sou= rce_id has a varied number of `integration_time`s.

Just an idea,
Jens<= /div>
--089e01294b1053e05a04fd1ee499--