Guest User

Untitled

a guest
Nov 15th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. ```
  2. widget_statistics_history.sql
  3. - hour_timestamp
  4. - site
  5. - composite
  6. - widget_category
  7. - widget_subnet
  8. - source_id (subid)
  9. - source_name (если возможно, попытаться извлечь со словаря по subid, composite)
  10. - traffic_source
  11. - traffic_type
  12. - country
  13. - device
  14. - os
  15. - ip
  16. - region
  17. - browser
  18. - wages sum
  19. - shows sum
  20. - real_shows sum
  21. - clicks_accepted sum
  22. - clicks_rejected sum
  23. - agent_ghits_wages sum (для каба)
  24. - revenue sum (для каба)
  25.  
  26. ```
  27.  
  28. ### Структура
  29. Предполагаемая структура новой таблицы
  30. ```
  31. CREATE TABLE statistics.widget_statistics_history
  32. (
  33. hour_timestamp UInt32,
  34. composite UInt32,
  35. site UInt32,
  36. source_id UInt32 DEFAULT 0,
  37. source_name String DEFAULT dictGetString('source_names', 'name', tuple(toUInt32(composite), toUInt32(source_id))),
  38. traffic_source String DEFAULT '',
  39. traffic_type String DEFAULT 'Direct',
  40. country UInt32 DEFAULT 0,
  41. device Enum8('desktop' = 1, 'mobile' = 2, 'tablet' = 3) DEFAULT 'desktop',
  42. os UInt8 DEFAULT 0,
  43. browser UInt8 DEFAULT 0,
  44. wages Int64 DEFAULT 0,
  45. shows Int32 DEFAULT 0,
  46. real_shows Int32 DEFAULT 0,
  47. clicks_accepted Int32 DEFAULT 0,
  48. clicks_rejected Int32 DEFAULT 0
  49. )
  50. ENGINE = SummingMergeTree((wages, shows, real_shows, clicks_accepted, clicks_rejected))
  51. PARTITION BY toDate(hour_timestamp)
  52. ORDER BY (hour_timestamp, composite, country, device, os, browser, source_id, source_name, traffic_source, traffic_type);
  53. ```
Add Comment
Please, Sign In to add comment