Skip to content

Instantly share code, notes, and snippets.

View simonrenoult's full-sized avatar
🏠
Working from home

Simon Renoult simonrenoult

🏠
Working from home
View GitHub Profile
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="avit"
HYPHEN_INSENSITIVE="true"
COMPLETION_WAITING_DOTS="true"
plugins=(autojump common-aliases docker extract httpie docker docker-compose kubectl)
source $ZSH/oh-my-zsh.sh
@RestController
public class HealthcheckApi {
private final SayImAlive sayImAlive;
public HealthcheckApi(SayImAlive sayImAlive) {
this.sayImAlive = sayImAlive;
}
@RequestMapping(value = "/healthcheck")
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o xtrace
# Script goes here...
mysql> EXPLAIN SELECT SQL_NO_CACHE * FROM articles WHERE article_id = '150001';
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+
| 1 | SIMPLE | articles | NULL | const | PRIMARY | PRIMARY | 34 | const | 1 | 100.00 | NULL |
+----+-------------+----------+------------+-------+---------------+---------+---------+-------+------+----------+-------+
1 row in set, 1 warning (0.00 sec)
mysql> SELECT SQL_NO_CACHE * FROM articles WHERE article_id = '150000';
+------------+---------------+-----------------+
| article_id | article_title | article_content |
+------------+---------------+-----------------+
| 150000 | Title 150000 | Content 150000 |
+------------+---------------+-----------------+
1 row in set (0.00 sec)
mysql> SELECT SQL_NO_CACHE * FROM articles WHERE article_id = 150000;
class Article {
private Integer article_id;
private String article_title;
private String article_content;
}
mysql> EXPLAIN SELECT SQL_NO_CACHE * FROM articles IGNORE INDEX(PRIMARY) WHERE article_id = 150000;
+----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+-------------+
| 1 | SIMPLE | articles | NULL | ALL | NULL | NULL | NULL | NULL | 996520 | 10.00 | Using where |
+----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+-------------+
1 row in set, 2 warnings (0.00 sec)
mysql> SELECT SQL_NO_CACHE * FROM articles IGNORE INDEX(PRIMARY) WHERE article_id = 150000;
+------------+---------------+-----------------+
| article_id | article_title | article_content |
+------------+---------------+-----------------+
| 150000 | Title 150000 | Content 150000 |
+------------+---------------+-----------------+
1 row in set, 1 warning (0.65 sec)
mysql> SELECT SQL_NO_CACHE * FROM articles USE INDEX(PRIMARY) WHERE article_id = 150000;
+------------+---------------+-----------------+
| article_id | article_title | article_content |
+------------+---------------+-----------------+
| 150000 | Title 150000 | Content 150000 |
+------------+---------------+-----------------+
1 row in set (0.62 sec)