{"id":10027,"date":"2016-01-12T09:00:15","date_gmt":"2016-01-12T00:00:15","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=10027"},"modified":"2018-11-14T16:33:46","modified_gmt":"2018-11-14T07:33:46","slug":"postgresql9-5-brin","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2016\/01\/12\/postgresql9-5-brin\/","title":{"rendered":"PostgreSQL 9.5 \u30ea\u30ea\u30fc\u30b9 : BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6c17\u306b\u306a\u308b"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3002\u677e\u672c\u3067\u3059\u3002<\/p>\n
PostgreSQL 9.5 \u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f\u306d\uff01<\/p>\n
\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306b\u3088\u308a\u3044\u304f\u3064\u304b\u306e\u65b0\u6a5f\u80fd\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u4e2d\u3067\u3082\u79c1\u304c\u6ce8\u76ee\u3057\u305f\u3044\u306e\u306f\u3001\u30a2\u30ca\u30a6\u30f3\u30b9\u3067\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u5411\u3051\u65b0\u6a5f\u80fd\u3068\u3057\u3066\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u3059\u3002<\/p>\n
BRIN Indexing: This new type of index supports creating tiny, but effective indexes for very large, \"naturally ordered\" tables. For example, tables containing logging data with billions of rows could be indexed and searched in 5% of the time required by standard BTree indexes.<\/p><\/blockquote>\n
\"BRIN\" \u306f \"Block Range Index\" \u306e\u7565\u3067\u3059\u3002<\/p>\n
PostgreSQL \u3067\u306f\u30c6\u30fc\u30d6\u30eb\u30c7\u30fc\u30bf\u3092\u30d6\u30ed\u30c3\u30af\u3068\u547c\u3070\u308c\u308b\u5358\u4f4d\u3067\u683c\u7d0d\u3057\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u30ec\u30b3\u30fc\u30c9\u304c\u3069\u306e\u30d6\u30ed\u30c3\u30af\u306e\u3069\u306e\u5834\u6240\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u60c5\u5831\u3068\u3057\u3066\u6301\u3063\u3066\u3044\u307e\u3059\u3002BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u306f\u3001\u9023\u7d9a\u3057\u3066\u4e26\u3076\u8907\u6570\u306e\u30d6\u30ed\u30c3\u30af\u3092\u307e\u3068\u3081\u3066\u6271\u3044\u3001\u300c\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u300d\u3054\u3068\u306b\u305d\u306e\u7bc4\u56f2\u306b\u542b\u307e\u308c\u308b\u30ec\u30b3\u30fc\u30c9\u306e\u30ab\u30e9\u30e0\uff08\u5f0f\uff09\u6700\u5927\u5024\u3068\u6700\u5c0f\u5024\u3092\u4fdd\u6301\u3057\u307e\u3059\u3002\u3053\u306e\u4ed5\u7d44\u307f\u306b\u3088\u308a\u3001\u6570\u5341\u5104\u884c\u30ec\u30d9\u30eb\u306e\u5de8\u5927\u306a\u30c7\u30fc\u30bf\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u9ad8\u901f\u306b\u884c\u3046\u3053\u3068\u3092\u53ef\u80fd\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n
\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u5b9f\u969b\u306b BRIN \u3092\u8a66\u3057\u3066\u307f\u308b<\/h2>\n
\u307e\u305a\u306f\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u3068\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0\u3002<\/p>\n
\r\npostgres=# CREATE TABLE brin_test_table (id serial, ts timestamp);\r\nCREATE TABLE\r\npostgres=# INSERT INTO brin_test_table (ts) SELECT generate_series(timestamp '2015-01-01 00:00:00', timestamp '2015-12-31 23:59:59', interval '1 seconds');\r\n\r\nINSERT 0 31536000\r\n<\/pre>\n\u7d04 3,000 \u4e07\u884c\u307b\u3069\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n
\u3053\u306e\u72b6\u614b\u3067 SELECT \u3059\u308b\u3068\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n
\r\npostgres=# EXPLAIN ANALYZE SELECT * FROM brin_test_table WHERE ts = timestamp '2015-06-01 00:00:00';\r\n QUERY PLAN\r\n----------------------------------------------------------------------------------------------------------------------\r\n Seq Scan on brin_test_table (cost=0.00..564665.30 rows=1 width=12) (actual time=8320.332..14432.488 rows=1 loops=1)\r\n Filter: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Rows Removed by Filter: 31535999\r\n Planning time: 0.043 ms\r\n Execution time: 14432.512 ms\r\n(5 rows)\r\n<\/pre>\n\u6b21\u306b BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n
PostgreSQL \u306e\u30d6\u30ed\u30c3\u30af\u30b5\u30a4\u30ba\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f 8KB \u3067\u3001\u3053\u308c\u3092\u5909\u66f4\u3059\u308b\u306b\u306f PostgreSQL \u3092\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b (--with-blocksize \u30aa\u30d7\u30b7\u30e7\u30f3<\/a>) \u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u304c\u3001BRIN \u306e\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u306e\u30b5\u30a4\u30ba\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f5c\u6210\u6642\u306e pages_per_range \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc<\/a>\u3067\u7c21\u5358\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n
\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u3044\u307b\u3069\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u308b\u60c5\u5831\u304c\u7d30\u3084\u304b\u306b\u306a\u308a\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b9\u30ad\u30e3\u30f3\u4e2d\u306b\u3001\u3088\u308a\u591a\u304f\u306e\u30d6\u30ed\u30c3\u30af\u304c\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3059\u304c\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u81ea\u4f53\u306e\u30b5\u30a4\u30ba\u306f\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n
\u4eca\u56de\u306f\u3068\u3082\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u8a2d\u5b9a\u306e\u307e\u307e\u3068\u3057\u307e\u3059\uff08\u30d6\u30ed\u30c3\u30af\u30b5\u30a4\u30ba 8KB\u3001\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba 128\uff09\u3002<\/p>\n
\r\npostgres=# CREATE INDEX brin_test_index ON brin_test_table USING BRIN (ts);\r\nCREATE INDEX\r\npostgres=# SHOW block_size;\r\n block_size\r\n------------\r\n 8192\r\n(1 row)\r\n<\/pre>\n\u30d6\u30ed\u30c3\u30af\u30b5\u30a4\u30ba\u304c 8KB \u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n
\u3053\u3053\u3067 BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u3069\u306e\u3088\u3046\u306b\u4f5c\u6210\u3055\u308c\u305f\u304b\u3001contrib \u306e pageinspect \u3092\u4f7f\u3063\u3066\u307f\u3066\u307f\u307e\u3059\u3002<\/p>\n
\u307e\u305a\u306f\u3001pageinspect \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n
\r\npostgres=# SELECT * FROM pg_available_extensions WHERE name = 'pageinspect';\r\n name | default_version | installed_version | comment\r\n-------------+-----------------+-------------------+-------------------------------------------------------\r\n pageinspect | 1.3 | | inspect the contents of database pages at a low level\r\n(1 row)\r\n\r\n\r\npostgres=# CREATE EXTENSION pageinspect;\r\nCREATE EXTENSION\r\npostgres=# SELECT * FROM pg_available_extensions WHERE name = 'pageinspect';\r\n name | default_version | installed_version | comment\r\n-------------+-----------------+-------------------+-------------------------------------------------------\r\n pageinspect | 1.3 | 1.3 | inspect the contents of database pages at a low level\r\n(1 row)\r\n<\/pre>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u60c5\u5831\u3092\u898b\u307e\u3059\u3002<\/p>\n
\r\npostgres=# SELECT * FROM brin_page_items(get_raw_page('brin_test_index', 2), 'brin_test_index');\r\n itemoffset | blknum | attnum | allnulls | hasnulls | placeholder | value\r\n------------+--------+--------+----------+----------+-------------+----------------------------------------------\r\n 1 | 0 | 1 | f | f | f | {2015-01-01 00:00:00 .. 2015-01-01 06:34:39}\r\n 2 | 128 | 1 | f | f | f | {2015-01-01 06:34:40 .. 2015-01-01 13:09:19}\r\n 3 | 256 | 1 | f | f | f | {2015-01-01 13:09:20 .. 2015-01-01 19:43:59}\r\n 4 | 384 | 1 | f | f | f | {2015-01-01 19:44:00 .. 2015-01-02 02:18:39}\r\n 5 | 512 | 1 | f | f | f | {2015-01-02 02:18:40 .. 2015-01-02 08:53:19}\r\n 6 | 640 | 1 | f | f | f | {2015-01-02 08:53:20 .. 2015-01-02 15:27:59}\r\n 7 | 768 | 1 | f | f | f | {2015-01-02 15:28:00 .. 2015-01-02 22:02:39}\r\n 8 | 896 | 1 | f | f | f | {2015-01-02 22:02:40 .. 2015-01-03 04:37:19}\r\n 9 | 1024 | 1 | f | f | f | {2015-01-03 04:37:20 .. 2015-01-03 11:11:59}\r\n 10 | 1152 | 1 | f | f | f | {2015-01-03 11:12:00 .. 2015-01-03 17:46:39}\r\n--More--\r\n<\/pre>\n128 \u30d6\u30ed\u30c3\u30af\u305a\u3064\u3001\u30b5\u30de\u30ea\u60c5\u5831\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n
\u3055\u3066\u3001SELECT \u306f\u3069\u3046\u306a\u3063\u305f\u304b\u306a\uff1f<\/p>\n
\r\npostgres=# EXPLAIN ANALYZE SELECT * FROM brin_test_table WHERE ts = timestamp '2015-06-01 00:00:00';\r\n QUERY PLAN\r\n\r\n----------------------------------------------------------------------------------------------------------------------------\r\n Bitmap Heap Scan on brin_test_table (cost=28.01..32.02 rows=1 width=12) (actual time=2.775..2.894 rows=1 loops=1)\r\n Recheck Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Rows Removed by Index Recheck: 23679\r\n Heap Blocks: lossy=128\r\n -> Bitmap Index Scan on brin_test_index (cost=0.00..28.01 rows=1 width=0) (actual time=0.413..0.413 rows=1280 loops=1)\r\n Index Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Planning time: 0.083 ms\r\n Execution time: 2.923 ms\r\n(8 rows)\r\n<\/pre>\nBRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u52b9\u3044\u3066\u3044\u308b\u306e\u304c\u898b\u3066\u53d6\u308c\u307e\u3059\u3002<\/p>\n
\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u3092\u5909\u3048\u3066\u306e\u6bd4\u8f03<\/h2>\n
BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3064\u3044\u3066\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306b\u306f\u6b21\u306e\u3088\u3046\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n
BRIN indexes can satisfy queries via regular bitmap index scans, and will return all tuples in all pages within each range if the summary info stored by the index is consistent with the query conditions. The query executor is in charge of rechecking these tuples and discarding those that do not match the query conditions \u2014 in other words, these indexes are lossy. Because a BRIN index is very small, scanning the index adds little overhead compared to a sequential scan, but may avoid scanning large parts of the table that are known not to contain matching tuples.<\/p>\n
(snip)<\/p>\n
The size of the block range is determined at index creation time by the pages_per_range storage parameter. The number of index entries will be equal to the size of the relation in pages divided by the selected value for pages_per_range. Therefore, the smaller the number, the larger the index becomes (because of the need to store more index entries), but at the same time the summary data stored can be more precise and more data blocks can be skipped during an index scan.<\/p><\/blockquote>\n
\u3053\u3053\u304b\u3089\u3001BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u3001\u300c\u30af\u30a8\u30ea\u306e\u5bfe\u8c61\u3068\u306a\u308b\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u306b\u542b\u307e\u308c\u308b\u30ec\u30b3\u30fc\u30c9\u3059\u3079\u3066\u3092\u8fd4\u3057\u3001\u30af\u30a8\u30ea\u5b9f\u884c\u90e8\u304c\u305d\u306e\u4e2d\u304b\u3089\u6761\u4ef6\u306b\u4e00\u81f4\u3057\u306a\u3044\u30ec\u30b3\u30fc\u30c9\u3092\u9664\u5916\u3059\u308b\uff08recheck\uff09\u300d\u3068\u3044\u3046\u70b9\u3068\u3001\u300c\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u3092\u5c0f\u3055\u304f\u8a2d\u5b9a\u3059\u308b\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b5\u30a4\u30ba\u304c\u5927\u304d\u304f\u306a\u308b\u300d\u3068\u3044\u3046\u70b9\u306b\u3064\u3044\u3066\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n
pages_per_range \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092 64, 128, 256 \u3068\u3057\u305f\u5834\u5408\u305d\u308c\u305e\u308c\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6982\u8981\u3068 EXPLAIN ANALYZE \u7d50\u679c\u3067\u3059\u3002<\/p>\n
pages_per_range = 64<\/p>\n
\r\npostgres=# \\di+ brin_test_index\r\n List of relations\r\n Schema | Name | Type | Owner | Table | Size | Description\r\n--------+-----------------+-------+----------+-----------------+--------+-------------\r\n public | brin_test_index | index | postgres | brin_test_table | 128 kB |\r\n(1 row)\r\n\r\npostgres=# EXPLAIN ANALYZE SELECT * FROM brin_test_table WHERE ts = timestamp '2015-06-01 00:00:00';\r\n QUERY PLAN\r\n---------------------------------------------------------------------------------------------------------------------------\r\n Bitmap Heap Scan on brin_test_table (cost=52.01..56.02 rows=1 width=12) (actual time=1.757..1.867 rows=1 loops=1)\r\n Recheck Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Rows Removed by Index Recheck: 11839\r\n Heap Blocks: lossy=64\r\n -> Bitmap Index Scan on brin_test_index (cost=0.00..52.01 rows=1 width=0) (actual time=0.795..0.795 rows=640 loops=1)\r\n Index Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Planning time: 0.103 ms\r\n Execution time: 1.895 ms\r\n(8 rows)\r\n<\/pre>\npages_per_range = 128<\/p>\n
\r\npostgres=# \\di+ brin_test_index\r\n List of relations\r\n Schema | Name | Type | Owner | Table | Size | Description\r\n--------+-----------------+-------+----------+-----------------+-------+-------------\r\n public | brin_test_index | index | postgres | brin_test_table | 80 kB |\r\n(1 row)\r\n\r\npostgres=# EXPLAIN ANALYZE SELECT * FROM brin_test_table WHERE ts = timestamp '2015-06-01 00:00:00';\r\n QUERY PLAN\r\n----------------------------------------------------------------------------------------------------------------------------\r\n Bitmap Heap Scan on brin_test_table (cost=28.01..32.02 rows=1 width=12) (actual time=2.349..2.463 rows=1 loops=1)\r\n Recheck Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Rows Removed by Index Recheck: 23679\r\n Heap Blocks: lossy=128\r\n -> Bitmap Index Scan on brin_test_index (cost=0.00..28.01 rows=1 width=0) (actual time=0.416..0.416 rows=1280 loops=1)\r\n Index Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Planning time: 0.126 ms\r\n Execution time: 2.482 ms\r\n(8 rows)\r\n<\/pre>\npages_per_range = 256<\/p>\n
\r\npostgres=# \\di+ brin_test_index\r\n List of relations\r\n Schema | Name | Type | Owner | Table | Size | Description\r\n--------+-----------------+-------+----------+-----------------+-------+-------------\r\n public | brin_test_index | index | postgres | brin_test_table | 64 kB |\r\n(1 row)\r\n\r\npostgres=# EXPLAIN ANALYZE SELECT * FROM brin_test_table WHERE ts = timestamp '2015-06-01 00:00:00';\r\n QUERY PLAN\r\n----------------------------------------------------------------------------------------------------------------------------\r\n Bitmap Heap Scan on brin_test_table (cost=20.01..24.02 rows=1 width=12) (actual time=2.251..5.061 rows=1 loops=1)\r\n Recheck Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Rows Removed by Index Recheck: 47359\r\n Heap Blocks: lossy=256\r\n -> Bitmap Index Scan on brin_test_index (cost=0.00..20.01 rows=1 width=0) (actual time=0.214..0.214 rows=2560 loops=1)\r\n Index Cond: (ts = '2015-06-01 00:00:00'::timestamp without time zone)\r\n Planning time: 0.101 ms\r\n Execution time: 5.082 ms\r\n(8 rows)\r\n<\/pre>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b5\u30a4\u30ba\u3092\u6bd4\u8f03\u3057\u3066\u898b\u308b\u3068\u3001128KB, 80KB, 64KB \u3068\u3044\u3046\u3088\u3046\u306b\u3001\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u3044\u307b\u3069\u5927\u304d\u304f\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n
recheck \u306b\u3088\u3063\u3066\u9664\u5916\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u6570\u306f 11,839 \u4ef6\u300123,679 \u4ef6\u300147,359 \u4ef6\u3068\u306a\u308a\u3001\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u3044\u307b\u3069\u5c11\u306a\u304f\u3001recheck \u51e6\u7406\u306e\u52b9\u7387\u304c\u5411\u4e0a\u3059\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u304c 128 \u306e\u30b1\u30fc\u30b9\u3092\u4f8b\u306b\u3068\u308b\u3068\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b9\u30ad\u30e3\u30f3\u306b\u3088\u3063\u3066\u9078\u629e\u3055\u308c\u305f\u30d6\u30ed\u30c3\u30af\u6570\u306f 128 \u3067\u3042\u308a\u3001\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f 1 \u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\uff08128 \u30d6\u30ed\u30c3\u30af\uff09\u8fba\u308a 23,680 \u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u542b\u3080\u306e\u3067\u3001\u3053\u3053\u304b\u3089\u9664\u5916\u3055\u308c\u305f 23,679 \u4ef6\u3092\u5f15\u304f\u3068\u8a72\u5f53\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u306f 1 \u4ef6\u3001\u3068\u3044\u3046\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
\u3053\u3053\u3067\u3001BRIN \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30b3\u30b9\u30c8\u306b\u3064\u3044\u3066\u898b\u3066\u307f\u308b\u3068 52.01, 28.01, 20.01 \u3068\u306a\u308a\u3001\u30d6\u30ed\u30c3\u30af\u7bc4\u56f2\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u3044\u307b\u3069\u5927\u304d\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306f\u591a\u304f\u306e\u5834\u5408\u3001\u7121\u8996\u3067\u304d\u308b\u307b\u3069\u5c0f\u3055\u3044\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n
EXPLAIN ANALYZE \u7d50\u679c\u3068\u3057\u3066\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u5b9f\u884c\u6642\u9593\u306b\u95a2\u3059\u308b\u6570\u5024\u306f\u3001\u69d8\u3005\u306a\u8981\u56e0\u306b\u3088\u3063\u3066\u5f71\u97ff\u3092\u53d7\u3051\u308b\u3082\u306e\u306a\u306e\u3067\u3001\u3053\u3053\u3067\u306f\u53c2\u8003\u7a0b\u5ea6\u306b\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n
\u6700\u5f8c\u306b<\/h2>\n
\u4eca\u56de\u3001\u304a\u8a66\u3057\u74b0\u5883\u3068\u3057\u3066 AWS \u306e EC2(Amazon Linux) t2.micro \u3092\u4f7f\u3044\u307e\u3057\u305f\u3002\u3053\u3046\u3044\u3046\u6642\u3001\u4f55\u306e\u6c17\u517c\u306d\u3082\u306a\u304f\u3001\u3059\u3050\u306b\u74b0\u5883\u3092\u7528\u610f\u3067\u304d\u308b\u306e\u306f\u672c\u5f53\u306b\u4fbf\u5229\u3067\u3059\u306d\u3002<\/p>\n
\u56e0\u307f\u306b\u3001\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u304f\u306b\u3042\u305f\u308a\u4e0a\u8a18\u74b0\u5883\u306b PostgreSQL 9.5 \u3092\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u305f\u304c\u3001Amazon Linux \u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u4f5c\u696d\u3092\u3059\u308b\u5834\u5408\u306f Development Tools<\/a> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u3059\u3002<\/p>\n
\r\n[ec2-user ~]$ sudo yum groupinstall \"Development Tools\"\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"