[postgres@vastDataEDU Desktop]$ psql psql (9.5.3) Type "help" for help. mydb=# \q [postgres@vastDataEDU Desktop]$ vi ~/.bashrc [postgres@vastDataEDU Desktop]$ psql psql (9.5.3) Type "help" for help. mydb=# \d List of relations Schema | Name | Type | Owner --------+---------------+-------+---------- public | onoroff | table | postgres public | player | table | postgres public | player_copy | table | postgres public | player_header | table | postgres (4 rows) mydb=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileg es -----------+----------+----------+-------------+-------------+------------------ ----- mydb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/post gres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/post gres (4 rows) mydb=# \d List of relations Schema | Name | Type | Owner --------+--------+-------+---------- public | player | table | postgres (1 row) mydb=# \dS+ player Table "public.player" Column | Type | Modifiers | Storage | Stats target | Description -------------------+------------------+-------------------------------------+---------+--------------+------------- play_pid | bigint | | plain | | play_pit | double precision | not null default random() | plain | | play_puuid | uuid | not null default uuid_generate_v4() | plain | | play_pocc | tp_pocc | | plain | | play_header | integer | | plain | | play_cloth | integer | | plain | | play_belt | integer | | plain | | play_trousers | integer | | plain | | play_shoes | integer | | plain | | play_ring | integer | | plain | | play_weapon_left | integer | | plain | | play_weapon_right | integer | | plain | | Indexes: "idx_play" btree (play_puuid) mydb=# drop index idx_play ; DROP INDEX mydb=# create index idx_pid on player using hash(play_pid); WARNING: hash indexes are not WAL-logged and their use is discouraged CREATE INDEX mydb=# \dS+ player Table "public.player" Column | Type | Modifiers | Storage | Stats target | Description -------------------+------------------+-------------------------------------+---------+--------------+------------- play_pid | bigint | | plain | | play_pit | double precision | not null default random() | plain | | play_puuid | uuid | not null default uuid_generate_v4() | plain | | play_pocc | tp_pocc | | plain | | play_header | integer | | plain | | play_cloth | integer | | plain | | play_belt | integer | | plain | | play_trousers | integer | | plain | | play_shoes | integer | | plain | | play_ring | integer | | plain | | play_weapon_left | integer | | plain | | play_weapon_right | integer | | plain | | Indexes: "idx_pid" hash (play_pid) mydb=# select play_pid from player limit 1; play_pid ---------- 2576801 (1 row) mydb=# select * from player where play_pid=2576801; play_pid | play_pit | play_puuid | play_pocc | play_header | play_cloth | play_belt | play_trousers | play_shoes | play_ring | play_weapon_left | play_weapon_right ----------+----------+------------+-----------+-------------+------------+-----------+---------------+------------+-----------+------------------+------------------- (0 rows) mydb=# explain select * from player where play_pid=2576801; QUERY PLAN ----------------------------------------------------------------------- Index Scan using idx_pid on player (cost=0.00..8.02 rows=1 width=68) Index Cond: (play_pid = 2576801) (2 rows) mydb=# set enable_indexscan=off mydb-# ; SET mydb=# explain select * from player where play_pid=2576801; QUERY PLAN ---------------------------------------------------------------------- Bitmap Heap Scan on player (cost=4.01..8.02 rows=1 width=68) Recheck Cond: (play_pid = 2576801) -> Bitmap Index Scan on idx_pid (cost=0.00..4.01 rows=1 width=0) Index Cond: (play_pid = 2576801) (4 rows) mydb=# set enable_seqscan=true; SET mydb=# explain select * from player where play_pid=2576801; QUERY PLAN ---------------------------------------------------------------------- Bitmap Heap Scan on player (cost=4.01..8.02 rows=1 width=68) Recheck Cond: (play_pid = 2576801) -> Bitmap Index Scan on idx_pid (cost=0.00..4.01 rows=1 width=0) Index Cond: (play_pid = 2576801) (4 rows) mydb=# drop index idx_pid; DROP INDEX mydb=# select * from player where play_pid=2576801; play_pid | play_pit | play_puuid | play_pocc | play_header | play_cloth | play_belt | play_trousers | play_shoes | play_ring | play_ weapon_left | play_weapon_right ----------+-------------------+--------------------------------------+-----------+-------------+------------+-----------+---------------+------------+-----------+------ ------------+------------------- 2576801 | 0.946175400633365 | 0a8140f0-66ff-4660-ab88-463427bd1dab | ms | -1808434140 | | | | | | | (1 row) mydb=# create index idx_pid on player using hash(play_pid); WARNING: hash indexes are not WAL-logged and their use is discouraged CREATE INDEX mydb=# select * from player where play_pid=2576801; play_pid | play_pit | play_puuid | play_pocc | play_header | play_cloth | play_belt | play_trousers | play_shoes | play_ring | play_weapon_left | play_weapon_right ----------+----------+------------+-----------+-------------+------------+-----------+---------------+------------+-----------+------------------+------------------- (0 rows) mydb=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- mydb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) mydb=# \db List of tablespaces Name | Owner | Location ------------+----------+-------------------- def | postgres | /pg/tablespace/def pg_default | postgres | pg_global | postgres | tmp | postgres | /pg/tablespace/tmp (4 rows) mydb=# select version(); version ---------------------------------------------------------------------------------------------------------- PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11), 64-bit (1 row) mydb=# \q [postgres@vastDataEDU Desktop]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 30048 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited