Технология KeyBunch упрощает процедуру связки данных, полученных из разных источников. С KeyBunch аналитики могут повысить качество своих предиктивных моделей за счет использования дополнительных сведениий о клиенте, не затрачивая много времени на подготовку данных. Работает с SQL и NoSQL-базами.
This document discusses third party patches for MySQL that provide quick wins and new features. It summarizes five such patches: 1) Slow query filtering which helps identify expensive queries, 2) Index statistics which helps determine unused indexes, 3) An InnoDB dictionary limit which constrains memory usage, 4) A global long query time setting, and 5) A "fix" for InnoDB group commit performance regressions in MySQL 5.0. The document encourages using third party patches to gain features and improvements not yet available in the MySQL core.
The document discusses three common ways to improve performance of a MySQL database that is experiencing high load:
1. Upgrade hardware by adding more RAM, faster disks, or more powerful CPUs. This provides a temporary fix but can become exponentially more expensive and does not address underlying issues.
2. Change MySQL configuration settings like tmp_table_size or sort_buffer_size to optimize for specific bottlenecks shown in global status variables, but there are no "silver bullets" and misconfigurations must be addressed.
3. Improve indexing and tune queries by addressing issues like temporary tables on disk, full table scans, and lack of indexes causing full joins or sorting, which can have long term benefits over simply adding resources
This document discusses techniques for optimizing Perl source code performance. It begins by cautioning against premature optimization and recommends first profiling code to identify actual bottlenecks. It then provides tips for different phases of optimization, starting with easy "low hanging fruit" like moving invariant expressions out of loops. Deeper changes include adding caching, changing data structures, and rewriting hot spots in C. The key messages are to measure first before optimizing and only optimize critical parts of code.
This document discusses third party patches for MySQL that provide quick wins and new features. It summarizes five such patches: 1) Slow query filtering which helps identify expensive queries, 2) Index statistics which helps determine unused indexes, 3) An InnoDB dictionary limit which constrains memory usage, 4) A global long query time setting, and 5) A "fix" for InnoDB group commit performance regressions in MySQL 5.0. The document encourages using third party patches to gain features and improvements not yet available in the MySQL core.
The document discusses three common ways to improve performance of a MySQL database that is experiencing high load:
1. Upgrade hardware by adding more RAM, faster disks, or more powerful CPUs. This provides a temporary fix but can become exponentially more expensive and does not address underlying issues.
2. Change MySQL configuration settings like tmp_table_size or sort_buffer_size to optimize for specific bottlenecks shown in global status variables, but there are no "silver bullets" and misconfigurations must be addressed.
3. Improve indexing and tune queries by addressing issues like temporary tables on disk, full table scans, and lack of indexes causing full joins or sorting, which can have long term benefits over simply adding resources
This document discusses techniques for optimizing Perl source code performance. It begins by cautioning against premature optimization and recommends first profiling code to identify actual bottlenecks. It then provides tips for different phases of optimization, starting with easy "low hanging fruit" like moving invariant expressions out of loops. Deeper changes include adding caching, changing data structures, and rewriting hot spots in C. The key messages are to measure first before optimizing and only optimize critical parts of code.
Performance Enhancements In Postgre Sql 8.4HighLoad2009
PostgreSQL 8.4 introduced several performance enhancements including optimizations to anti-joins, semi-joins, hash aggregation, and new free space map and visibility map features. It also included application-level improvements such as subqueries in LIMIT/OFFSET clauses, window functions, common table expressions, and parallel restore. Many changes provided performance benefits transparently to applications or DBAs while some required application changes to realize gains.
87. – В жизни – под 1000 (а не 3) записей на страничку – Два уровня страничек – 1000*1000 – миллион – Три уровня – миллиард … – Итого 2-3 странички max – практически всегда 3 Аня 141 Боря 592 Ваня id key 653 Гоша 589 Дима 793 Ева id key 238 Женя 462 Зина 643 Ира id key 383 Коля 279 Лена 502 Маша id key Аня Гоша Ева Женя Коля Маша Аня Женя Маша
101. SELECT * FROM users WHERE id=123 1 . “ Ищем Зину ” (rowoffset по id=123) 2. seek(rowoffset) в файле строк ( .MYD) 3. read(rowdata) из файла 4. и… все – результат готов
105. 12352 F 12351 F 12350 F 12349 F 12348 F 12347 F 12346 F 12345 F id key 12360 F 12359 F 12358 F 12357 F 12356 F 12355 F 12354 F 12353 F id key 12368 F 12367 F 12366 F 12365 F 12364 F 12363 F 12362 F 12361 F id key 12376 F 12375 F 12374 F 12373 F 12372 F 12371 F 12370 F 12369 F id key
106. 12352 F 12351 F 12350 F 12349 F 12348 F 12347 F 12346 F 12345 F id key 12360 F 12359 F 12358 F 12357 F 12356 F 12355 F 12354 F 12353 F id key 12368 F 12367 F 12366 F 12365 F 12364 F 12363 F 12362 F 12361 F id key 12376 F 12375 F 12374 F 12373 F 12372 F 12371 F 12370 F 12369 F id key
109. … и нам надо прочитать с диска (!) 5,000,000+ строк…
110. … и для каждой лично проверить паспорт и age>=18 and age<=25?!
111. 12352 F 12351 F 12350 F 12349 F 12348 F 12347 F 12346 F 12345 F id key 12360 F 12359 F 12358 F 12357 F 12356 F 12355 F 12354 F 12353 F id key 12368 F 12367 F 12366 F 12365 F 12364 F 12363 F 12362 F 12361 F id key 12376 F 12375 F 12374 F 12373 F 12372 F 12371 F 12370 F 12369 F id key
151. CREATE TABLE usertest ( id INTEGER PRIMARY KEY NOT NULL, sex ENUM ('m','f'), age INTEGER NOT NULL, hotness INTEGER NOT NULL, name VARCHAR(255) NOT NULL, INDEX (sex,age,hotness) )
153. mysql> explain select * from usertest where sex='f' and age>=18 and age<=25 order by hotness desc limit 10 \G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: usertest type: ref possible_keys: sex key: sex key_len: 2 ref: const rows: 25119 Extra: Using where; Using filesort 1 row in set (0.00 sec)
154. filesort – НЕ про временный файл filesort – про “ сортировку строк ”
157. mysql> explain select * from usertest where sex='f' and age=18 order by hotness desc limit 10 \G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: usertest type: ref possible_keys: sex key: sex key_len: 6 ref: const,const rows: 10386 Extra: Using where (bug #30733, 30 aug 2007?) 1 row in set (0.00 sec)
159. mysql> select * from usertest where sex= ' f ' and age>=18 and age<=25 order by hotness desc limit 10; ... 10 rows in set ( 23 .05 sec) mysql> select * from usertest where sex='f' and age=18 order by hotness desc limit 10; ... 10 rows in set (0.05 sec)
161. mysql> explain select * from usertest where sex='f' and age>=18 and age<=25 order by hotness desc limit 10 \G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: usertest type: ref possible_keys: sex key: sex key_len: 2 используется только начало, поле “sex”!!! ref: const rows: 25119 Extra: Using where; Using filesort так и есть :( 1 row in set (0.00 sec)
162. MySQL не умеет сортировать элементы индекса :(
163. сортировка “ по индексу ” – только если индекс гарантирует порядок
164. 1) в куске индекса sex=F, 18<=age<=25 порядок hotness desc НЕ гарантирован
165. 2) optimizer лажанул, 18<=age<=25 считается НЕ по индексу (а могло бы)
168. mysql> explain select * from usertest where sex='f' order by hotness desc limit 10 \G ... key: sex key_len: 2 ref: const rows: 226072 Extra: Using where; Using filesort mysql> explain select * from usertest where sex='f' order by hotness desc limit 10 \G ... 10 rows in set ( 20 . 25 sec)
170. mysql> explain select * from usertest where sex='f' and hotness>0 order by age asc limit 10 \G ... key: sex key_len: 2 ref: const rows: 226072 Extra: Using where; Using filesort mysql> select * from usertest where sex='f' and hotness>0 order by age asc limit 10; ... 10 rows in set ( 0 . 25 sec)
171. итого HELL NO 20 . 2 5 Order – Const=F 0. 2 5 0.0 5 23 .05 Time Order Const=18 Range=18..25 Age Cond>0 Order Order Hotness KINDA OK Const=F OK Const=F HELL NO Const=F Optimal Sex
178. про ошибки optimizer и спасительный full-scan
179. mysql> select * from usertest where sex='f' order by hotness desc limit 10; ... 10 rows in set (20.25 sec) mysql> select * from usertest ignore index(sex) where sex='f' order by hotness desc limit 10; ... 10 rows in set (0.55 sec)
180. 10,000 x 10 ms = 100 sec 100,000 x 1KB / 50 M/s = 2 sec
181. мораль : random IO очень плохо (водка яд водка яд водка яд)
209. XML дамп -> 2 толстые таблицы хочется – а) одну б) тонкую !
210. INSERT INTO my content SELECT t.old_id, p.page_id, UNIX_TIMESTAMP(p.page_touched), p.page_len, p.page_title, COMPRESS(t.old_text) FROM text t, page p WHERE t.old_id=p.page_latest AND page_namespace=0 AND page_is_redirect=0; 15 GB text, 0.5 GB page, ~4.5M rows tps=~200, bi/bo=~1 MB/sec ~200 MB .MYD in ~20 mins, ETA 10+ hrs
211. mysql> EXPLAIN SELECT t.old_id, ... \G ********************** 1. row ********************** table: p age type: ref key: name_title ref: const rows: 4435392 Extra: Using where ********************** 2. row ********************** table: t ext type: eq_ref key: PRIMARY ref: wiki.p.page_latest rows: 1
#2: Объявляю в хате доклад. Меня зовут Андрей Аксенов, и в этом докладе я хочу поделиться своими философскими соображениями на неожиданную тему – зачем вообще разработчику знать алгоритмы.
#3: Уверен, что немалой части зала крайне интересно – кто вообще этот человек с микрофоном, и зачем нам его занудная философия ? Вопрос актуальный, нужно пояснить.