This document discusses Yarn and its advantages over npm. It notes that Yarn uses yarn.lock files instead of npm-shrinkwrap.json files to lock down dependency versions. Yarn is also described as being faster, able to work offline by caching dependencies, and potentially more secure than npm with features like flat mode and module folders. The document suggests Yarn may handle dependencies and devDependencies differently than npm, and questions whether the yarn.lock file should be committed to source control.
"손코딩뇌컴파일눈디버깅" 모임을 소개합니다.
백문이 불여일런, 트라이얼앤에러(Trial and Error) 식의 몹쓸 교육을 받아 온 개발자들이 코딩하기 전에 신중하고 꼼꼼하게 생각해보기란 쉽지 않습니다.
개발 시간 중 디버깅 시간이 절반 이상을 차지하고 있는 실정에 버그를 줄이기 위해 TDD니 유닛테스트니 많은 방법들이 개발되고 있지만 가장 일차적으로 중요한 것은 개발자들이 꼼꼼히 따져보는 것이 아니겠는지요?
미국의 선진 SW회사들은 이미 화이트보드에 PS문제를 푸는 것을 인터뷰 방식으로 채택하고 있습니다. 이는 이와 같은 풀이 방식이 개발자들의 기본 역량을 측정하기에 알맞은 지표라는 것이고, 개발자들이 기본적으로 갖춰야 할 역량이기도 하다는 것 입니다.
또한 자신의 생각을 명확하게 정리하고 다른 사람이 이해할 수 있도록 전달하는 Communication Skill 도 개발자가 갖춰야 할 역량 중 하나 입니다. 알고리즘을 어떻게 구현할 것인가를 팀원들과 소통하면서 자연스럽게 생각을 정리하고 전달하는 연습도 할 수 있습니다.
컴퓨터에 앉아 코딩하기 전 펜과 종이를 들고 눈과 머리와 손을 굴려 보시는 것은 어떠신지요??
"손코딩뇌컴파일눈디버깅" 모임을 소개합니다.
백문이 불여일런, 트라이얼앤에러(Trial and Error) 식의 몹쓸 교육을 받아 온 개발자들이 코딩하기 전에 신중하고 꼼꼼하게 생각해보기란 쉽지 않습니다.
개발 시간 중 디버깅 시간이 절반 이상을 차지하고 있는 실정에 버그를 줄이기 위해 TDD니 유닛테스트니 많은 방법들이 개발되고 있지만 가장 일차적으로 중요한 것은 개발자들이 꼼꼼히 따져보는 것이 아니겠는지요?
미국의 선진 SW회사들은 이미 화이트보드에 PS문제를 푸는 것을 인터뷰 방식으로 채택하고 있습니다. 이는 이와 같은 풀이 방식이 개발자들의 기본 역량을 측정하기에 알맞은 지표라는 것이고, 개발자들이 기본적으로 갖춰야 할 역량이기도 하다는 것 입니다.
또한 자신의 생각을 명확하게 정리하고 다른 사람이 이해할 수 있도록 전달하는 Communication Skill 도 개발자가 갖춰야 할 역량 중 하나 입니다. 알고리즘을 어떻게 구현할 것인가를 팀원들과 소통하면서 자연스럽게 생각을 정리하고 전달하는 연습도 할 수 있습니다.
컴퓨터에 앉아 코딩하기 전 펜과 종이를 들고 눈과 머리와 손을 굴려 보시는 것은 어떠신지요??
This document summarizes new features and improvements in MySQL 8.0. Key highlights include utf8mb4 becoming the default character set to support Unicode 9.0, performance improvements for utf8mb4 of up to 1800%, continued enhancements to JSON support including new functions, expanded GIS functionality including spatial reference system support, and new functions for working with UUIDs and bitwise operations. It also provides a brief history of MySQL and outlines performance improvements seen in benchmarks between MySQL versions.
This document summarizes benchmarks of MySQL multi-thread slave performance using different numbers of slave_parallel_workers threads on Oracle Cloud MySQL instances. It finds that using 16 threads provides the best performance, processing queries faster and keeping the slave less behind the master compared to lower thread counts. CPU usage is also lower with 16 threads even though more threads are used.
6. Explain (SQL Execution Plan)
root@localhost [mysql]> explain select id from memo where id = 1;
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
| 1 | SIMPLE | memo | NULL | const | PRIMARY | PRIMARY | 4 | const | 1 | 100.00 | Using index |
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)
postgresql=# explain select id from memo where id = 1;
QUERY PLAN
-----------------------------------------------------------------------------
Index Only Scan using idx_memo_id on memo (cost=0.28..8.29 rows=1 width=4)
Index Cond: (id = 1)
MySQL, PostgreSQLのANALYZEによる統計情報は厳密なものではなくランダムなサンプリングを行った結果であり、
実際の処理は実際のデータ分布、インデックス、プラットフォーム等、その他の要因にも依存します。
https://www.postgresql.jp/document/11/html/using-explain.html
https://dev.mysql.com/doc/refman/8.0/en/using-explain.html
7. Basic Expain
MySQL
root@localhost [confirm]> explain select id from memo where id = 1;
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
| 1 | SIMPLE | memo | NULL | const | PRIMARY | PRIMARY | 4 | const | 1 | 100.00 | Using index |
+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec)
root@localhost [confirm]> show warnings;
+-------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------------------+
| Note | 1003 | /* select#1 */ select '1' AS `id` from `confirm`.`memo` where true |
+-------+------+--------------------------------------------------------------------+
1 row in set (0.00 sec)
root@localhost [confirm]> explain for connection 38017;
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+
| 1 | SIMPLE | memo | NULL | ALL | NULL | NULL | NULL | NULL | 10 | 100.00 | NULL |
+----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+
1 row in set (0.00 sec)
EXPLAIN (DESC)は、SELECT、DELETE、INSERT、REPLACE、およびUPDATEステートメントで機能します。MySQL 8.0.19以降では、
TABLEステートメントでも機能します。explainで実行プランを確認したのちに、show warningsを実行する事で、実際にMySQLの
オプティマイザが書換え最適化したSQLを確認可能です。また、explain for connectionで特定の接続の実行プランを確認する事も可能です。
8. Basic Expain
PostgreSQL
app=# explain select id from memo where id = 1;
QUERY PLAN
-----------------------------------------------------------------------------
Index Only Scan using idx_memo_id on memo (cost=0.28..8.29 rows=1 width=4)
Index Cond: (id = 1)
(2 行)
app=# explain analyze select id from memo where id = 1;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
Index Only Scan using idx_memo_id on memo (cost=0.28..8.29 rows=1 width=4) (actual time=0.011..0.012 rows=1 loops=1)
Index Cond: (id = 1)
Heap Fetches: 1
Planning Time: 0.046 ms
Execution Time: 0.021 ms
(5 行)
EXPLAINはSELECT,INSERT、UPDATE、DELETE、CREATE TABLE AS、EXECUTで機能します。
(cost=0.28..8.29 rows=1 width=4)
- 初期処理の推定コスト。 出力段階が開始できるようになる前に消費される時間。
- 全体推定コスト。 これは計画ノードが実行完了である、つまりすべての利用可能な行を受け取ることを前提として示される。
- 計画ノードが出力する行の推定数。rowsの値は、計画ノードによって処理あるいはスキャンされた行数を表しておらず、ノードによって発行された行数を表す。
- この計画ノードが出力する行の(バイト単位での)推定平均幅。
9. Expain Options
MySQL
root@localhost [confirm]> explain analyze select * from memo where id = 1G
*************************** 1. row ***************************
EXPLAIN: -> Rows fetched before execution (actual time=0.000..0.000 rows=1 loops=1)
1 row in set (0.00 sec)
root@localhost [confirm]> explain analyze select * from memo where id >= 1 and id < 10 G
*************************** 1. row ***************************
EXPLAIN: -> Filter: ((memo.id >= 1) and (memo.id < 10)) (cost=2.06 rows=9) (actual time=0.016..0.027 rows=9 loops=1)
-> Index range scan on memo using PRIMARY (cost=2.06 rows=9) (actual time=0.014..0.023 rows=9 loops=1)
1 row in set (0.00 sec)
root@localhost [confirm]> explain analyze update memo set data = 'analyze テスト' where id = 1G
*************************** 1. row ***************************
EXPLAIN: <not executable by iterator executor>
1 row in set (0.00 sec)
参考: https://dev.mysql.com/doc/refman/8.0/en/explain.html
MySQL 8.0.18はEXPLAIN ANALYZEを導入しています。EXPLAIN ANALYZEは、SELECTステートメントだけでなく、
複数テーブルのUPDATEおよびDELETEステートメントでも使用できます。 MySQL 8.0.19からは、TABLEステートメントでも使用できます。
WL#4168: Implement EXPLAIN ANALYZE
10. Expain Options
PostgreSQL
app=# explain (analyze on, buffers on, verbose on) select id from memo where id = 1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Index Only Scan using idx_memo_id on public.memo (cost=0.28..8.29 rows=1 width=4) (actual time=0.027..0.029 rows=1 loops=1)
Output: id
Index Cond: (memo.id = 1)
Heap Fetches: 1
Buffers: shared hit=3
Planning Time: 0.084 ms
Execution Time: 0.051 ms
(7 行)
app=# explain verbose select * from memo where id = 1;
QUERY PLAN
--------------------------------------------------------------------------------
Index Scan using idx_memo_id on public.memo (cost=0.28..8.29 rows=1 width=25)
Output: id, data, data2
Index Cond: (memo.id = 1)
(3 行)
参考: https://www.postgresql.jp/document/11/html/sql-explain.html
解析でEXPLAINの出力をプログラムに渡すことを考えているのであれば、代わりに機械読み取りが容易な出力書式(XML、JSON、YAML)のいずれかを使用する事も可能です。
指定
取得 確認可能
11. Expain Output Format
MySQL
参考: https://dev.mysql.com/doc/refman/8.0/en/explain.html
[mysql]> explain format=TRADITIONAL select id from memo where id >= 1 and id < 10G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: memo
partitions: NULL
type: range
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: NULL
rows: 9
filtered: 100.00
Extra: Using where; Using index
1 row in set, 1 warning (0.00 sec)
root@localhost [confirm]>
[mysql]> explain format=TREE select id from memo where id >= 1 and id < 10G
*************************** 1. row ***************************
EXPLAIN: -> Filter: ((memo.id >= 1) and (memo.id < 10)) (cost=2.06 rows=9)
-> Index range scan on memo using PRIMARY (cost=2.06 rows=9)
1 row in set (0.01 sec)
[mysql]> explain format=JSON select id from memo where id = 1G
*************************** 1. row ***************************
EXPLAIN: {
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "1.00"
},
"table": {
"table_name": "memo",
<SNIP>
"using_index": true,
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.10",
"prefix_cost": "0.00",
"data_read_per_join": "16"
},
"used_columns": [
"id"
]
}
}
1 row in set, 1 warning (0.00 sec)
詳細
見積
12. Expain Output Format
PostgreSQL
参考: https://www.postgresql.jp/document/11/html/sql-explain.html
解析でEXPLAINの出力をプログラムに渡すことを考えているのであれば、代わりに機械読み取りが容易な出力書式(XML、JSON、YAML)のいずれかを使用する事も可能です。
app=# explain (FORMAT YAML) select id
app=# from memo where id = 1;
QUERY PLAN
----------------------------------
- Plan: +
Node Type: "Index Only Scan"+
Parallel Aware: false +
Scan Direction: "Forward" +
Index Name: "idx_memo_id" +
Relation Name: "memo" +
Alias: "memo" +
Startup Cost: 0.28 +
Total Cost: 8.29 +
Plan Rows: 1 +
Plan Width: 4 +
Index Cond: "(id = 1)"
(1 行)
app=# explain (FORMAT JSON) select id
app=# from memo where id = 1;
QUERY PLAN
---------------------------------------
[ +
{ +
"Plan": { +
"Node Type": "Index Only Scan",+
"Parallel Aware": false, +
"Scan Direction": "Forward", +
"Index Name": "idx_memo_id", +
"Relation Name": "memo", +
"Alias": "memo", +
"Startup Cost": 0.28, +
"Total Cost": 8.29, +
"Plan Rows": 1, +
"Plan Width": 4, +
"Index Cond": "(id = 1)" +
} +
} +
]
(1 行)
app=# explain (FORMAT XML) select id
app-# from memo where id = 1;
QUERY PLAN
----------------------------------------------------------
<explain xmlns="http://www.postgresql.org/2009/explain">+
<Query> +
<Plan> +
<Node-Type>Index Only Scan</Node-Type> +
<Parallel-Aware>false</Parallel-Aware> +
<Scan-Direction>Forward</Scan-Direction> +
<Index-Name>idx_memo_id</Index-Name> +
<Relation-Name>memo</Relation-Name> +
<Alias>memo</Alias> +
<Startup-Cost>0.28</Startup-Cost> +
<Total-Cost>8.29</Total-Cost> +
<Plan-Rows>1</Plan-Rows> +
<Plan-Width>4</Plan-Width> +
<Index-Cond>(id = 1)</Index-Cond> +
</Plan> +
</Query> +
</explain>
(1 行)
17. Need to Know
PostgreSQL (INSERT, UPDATE, DELETE) - 使用 場合 実際 実行
app=# explain analyze delete from memo where id = 1000;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Delete on memo (cost=0.28..8.62 rows=2 width=6) (actual time=0.080..0.080 rows=0 loops=1)
-> Index Scan using idx_memo_id on memo (cost=0.28..8.62 rows=2 width=6) (actual time=0.020..0.023 rows=2 loops=1)
Index Cond: (id = 1000)
Planning Time: 0.086 ms
Execution Time: 0.111 ms
(5 行)
app=# select * from memo where id = 1000;
id | data | data2
----+------+-------
(0 行)
app=# explain (analyze on, buffers on) delete from memo where id = 112;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Delete on memo (cost=0.28..8.29 rows=1 width=6) (actual time=0.027..0.027 rows=0 loops=1)
Buffers: shared hit=4 dirtied=1
-> Index Scan using idx_memo_id on memo (cost=0.28..8.29 rows=1 width=6) (actual time=0.008..0.008 rows=1 loops=1)
Index Cond: (id = 112)
Buffers: shared hit=3
Planning Time: 0.077 ms
Execution Time: 0.082 ms
(7 行)
app=# select id from memo where id = 112;
id
----
(0 行)
使用 場合 文 実際 実行 忘
返 出力 表示 文 伴 副作用 通常通 発生
文 対
影響 与 実行 場合 以下 方法 使用
参照
※ 実際 更新