2016-04-06 12 views

cevap

3

Liste sen-harf kullanmak için, ne için Refereri 100'den fazla milyonlarca olması tavsiye edilmez , yukarıdaki şema ile unutmayınız aşağıdaki şemayı

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'; 

dikkate doğru yapı değildir her çift (client_id, hit_type)

İlgili konular