postgresql slow: primary key on 80M row table -


i've 64gb ram machine, 20 cpus, , command create primary key on table 80m rows:

alter table wikipedia_article add constraint pagelinks_pkey primary key (language, title); 

the problem i've got that:

  • only 1 cpu used 100% (avg load 99%), rest aren't used @ all
  • the write speed during primary key creation quite low, 2.6 m/s, read speed missing report produced pg_activity

this table structure:

                          table "public.wikipedia_article"     column    |       type       | modifiers | storage  | stats target | description --------------+------------------+-----------+----------+--------------+-------------  language     | text             | not null  | extended |              |  title        | text             | not null  | extended |              |  langcount    | integer          |           | plain    |              |  othercount   | integer          |           | plain    |              |  totalcount   | integer          |           | plain    |              |  lat          | double precision |           | plain    |              |  lon          | double precision |           | plain    |              |  importance   | double precision |           | plain    |              |  osm_type     | character(1)     |           | extended |              |  osm_id       | bigint           |           | plain    |              |  infobox_type | text             |           | extended |              |  population   | bigint           |           | plain    |              |  website      | text             |           | extended |              | has oids: no 

the import happens automatically via pg_restore, source

http://www.nominatim.org/data/wikipedia_article.sql.bin

any ideas on can try make things faster? changed value of conf varible "maintenance_work_mem" half of ram size. tried change of kernel settings, no joy:

sysctl -w kernel.shmmax=17179869184 sysctl -w kernel.shmall=1048576 sysctl vm.overcommit_memory=1  sysctl vm.swappiness=10 

the os running on vm, in digital ocean, on ssd drives, expecting work faster such vm configuration.

server info: postgresql 9.3.13 on x86_64-unknown-linux-gnu, compiled gcc (ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4, 64-bit

many thanks, vg

postgresql uses 1 statement 1 cpu - cpu utilization 100% expected. can try set maintenance_work_mem higher value. default low - can try '2gb' example.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -