Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Агрегация и обработка статистики
Search
Yehor Nazarkin
August 12, 2013
Programming
5.7k
0
Share
Агрегация и обработка статистики
Доклад Валерия Змиевского, kharkivpy #8
Yehor Nazarkin
August 12, 2013
More Decks by Yehor Nazarkin
See All by Yehor Nazarkin
Flask, гордость и предубеждения
nimnull
0
340
Python non-mainstream web
nimnull
0
170
Write once, run everywhere
nimnull
0
6.3k
GPU Computing in Python
nimnull
1
5.7k
To Flask or not to Flask
nimnull
5
640
MongoDB Без ORM
nimnull
0
320
REST in Flask (And small client-side intro)
nimnull
10
1.7k
Other Decks in Programming
See All in Programming
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
240
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
920
KagglerがMixSeekを触ってみた
morim
0
390
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
250
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
Kingdom of the Machine
yui_knk
2
240
Vibe NLP for Applied NLP
inesmontani
PRO
0
420
Liberating Ruby's Parser from Lexer Hacks
ydah
2
930
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
500
実践CRDT
tamadeveloper
0
560
Making the RBS Parser Faster
soutaro
0
230
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
250
Featured
See All Featured
New Earth Scene 8
popppiees
3
2.1k
Color Theory Basics | Prateek | Gurzu
gurzu
0
290
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
180
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Code Reviewing Like a Champion
maltzj
528
40k
Being A Developer After 40
akosma
91
590k
Are puppies a ranking factor?
jonoalderson
1
3.3k
Skip the Path - Find Your Career Trail
mkilby
1
110
Speed Design
sergeychernyshev
33
1.6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
320
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
Transcript
Агрегация и обработка статистики реального времени Валерий Змиевской
Что нам нужно? • База данных • Отказаться от запросов:
group by keyfield … order by sum(datafield) desc • Upsert MongoDB, MySQL - есть нативный синтаксис
Как хранить данные Хранить данные для каждого ключа группировки в
отдельной таблице: user : [last_login, orders, coupons_used, …] category, date : [orders_amount, items_sold] region, date : [orders_amount, items_sold] ….
OLAP-куб на одной таблице Ключи : данные [region, category, year,
month] : [ord, isold] [<all>, 12, 2013, 01] : [100, 665] [<all>, <all>, 2013, 01] : [1600, 5200] ….
Срезы [region, category, year, month] [0, 0, 1, 0], [0,
0, 1, 1], [1, 0, 1, 0], [1, 0, 1, 1] [0, 1, 1, 0], [0, 1, 1, 1], [1, 1, 1, 0], [1, 1, 1, 1] [0, 1, 0, 0], [1, 1, 0, 0] Не нужны срезы: [*, *, 0, 1] и [*, 0, 0, 0]
Показываем: category, графики по месяцам Сортируем: ord, isold Индексы: •
region, category, year, month - unique|Charts • region, year, month, ord - Orders/Category • region, year, month, isold - It. sold/Category Индексы
Запросы: Категории: region=<all>, year=<all>, month=<all> region=EU, year=<all>, month=<all> region=EU, year=2013,
month=<all> График по категории Goods за 2013 год region=EU, year=2013, category=’Goods’