2016-04-06 7 views

答えて

3

リストは、使用ケースのための右の構造ではない、次のスキーマ

CREATE TABLE statistics(
    client_id VARCHAR, 
    hit_type text, 
    referer text, 
    page text, 
    event text, 
    PRIMARY KEY ((client_id,hit_type), referer) 
); 

// Insert hits 
INSERT INTO statistics(client_id, hit_type, referer, page) 
VALUES('client1','PAGE', 'http://example.com/asd', '{"title": "Page title"}'); 

INSERT INTO statistics(client_id, hit_type, referer, event) 
VALUES('client1','EVENT', 'http://example.com/dsa', '{"title": "Click on big button"}'); 

INSERT INTO statistics(client_id, hit_type, referer, page) 
VALUES('client1','PAGE', 'http://example.com/fgd', '{"title": "Page title second"}'); 

//Select all hits for a given client and hit type: 
SELECT * FROM statistics WHERE client_id='xxx' AND hit_type='PAGE'; 

を考えるためのリファラーの100以上の百万人を持っている上記のスキーマ、でそれがを推奨されませんのでご注意ください各カップル(クライアントID、ヒットタイプ)

関連する問題