Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

Is C collation suitable for my Postgres database?

$
0
0

I am working with 500m rows (120GB) in Postgres 9.4, and I am trying to make SELECT statements as fast as possible. I am less concerned about the speed of INSERT and UPDATE, because my data only changes once a quarter and I’ll probably use a backup database and switch over when that happens.

I’m working on a Debian Wheezy server, with 32GB of RAM and 320GB of solid-state. I have set maintenance_work_mem to 16GB while setting up the database, and shared_buffers to 12GB.

I have found that creating indexes is slow, and even with indexes, SELECT queries are still quite slow. To help this, I’ve been recommended to use the C collation for the database.

I’ve been reading through the collation documentation, but it doesn’t answer all my questions. So here’s what I want to do with my database:

  • Support fast SELECT * FROM mytable WHERE col1='020406AAA' queries.
  • Support fast SELECT * FROM mytable WHERE col1 LIKE '02%' queries.
  • Allow non-ASCII characters in some columns (e.g. Ménière's disease). This isn’t absolutely critical, though – I could convert these to ASCII if it would really help for speed.
  • Add the PostGIS extensions to the database.

Are any of these contra-indications for using the C collation?

I’m expecting all the columns where I want to use LIKE queries to consist of digits and uppercase letters only.

The data is a UK dataset, in English, for UK-only users. So I’m not expecting to have to add internationalization.


Viewing all articles
Browse latest Browse all 1138

Latest Images

Trending Articles



Latest Images