Sign inSign up

dungvti/postgres-bigm

By dungvti

•Updated 8 months ago

PostgreSQL 18 with pg_bigm — bigram full-text search for CJK (Japanese, Chinese, Korean) and more.

Image
Databases & storage
0

10K+

dungvti/postgres-bigm repository overview

⁠PostgreSQL + pg_bigm

PostgreSQL 18 pre-built with pg_bigm⁠ — a bigram-based full-text search extension optimized for CJK languages (Japanese, Chinese, Korean) and any language without word delimiters.

Drop-in replacement for postgres:18. No extra setup — pg_bigm is auto-loaded and the extension is created automatically on first start.

⁠Variants

TagBaseSizeBest for
18-alpinepostgres:18-alpine~282 MBCI/CD, TestContainers, lightweight
18-bookworm / latestpostgres:18-bookworm~462 MBProduction, enterprise, glibc
compatibility

⁠Quick Start

docker run -d \
  -e POSTGRES_PASSWORD=secret \
  -p 5432:5432 \
  dungvti/postgres-bigm:18-alpine

Then verify:

SELECT * FROM pg_extension WHERE extname = 'pg_bigm';
-- pg_bigm is ready to use

⁠Usage Example

-- Create a bigram index
CREATE INDEX idx_products_name ON products USING gin (name gin_bigm_ops);

-- Search with LIKE — uses the bigram index
SELECT * FROM products WHERE name LIKE '%コーヒー%';
SELECT * FROM products WHERE name LIKE '%咖啡%';
SELECT * FROM products WHERE name LIKE '%커피%';

⁠Tag Strategy

# Latest PG 18 + latest pg_bigm
dungvti/postgres-bigm:latest
dungvti/postgres-bigm:18-alpine
dungvti/postgres-bigm:18-bookworm

# Pinned pg_bigm version (reproducible builds)
dungvti/postgres-bigm:18-alpine-1.2-20250903
dungvti/postgres-bigm:18-bookworm-1.2-20250903

# Date-based (rollback)
dungvti/postgres-bigm:18-alpine-20260313
dungvti/postgres-bigm:18-bookworm-20260313

⁠Docker Compose

services:
  postgres:
    image: dungvti/postgres-bigm:18-alpine
    environment:
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: myapp
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

⁠TestContainers (Java)

@Container
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>(
    DockerImageName.parse("dungvti/postgres-bigm:18-alpine")
        .asCompatibleSubstituteFor("postgres")
);

⁠What is pg_bigm?

pg_bigm splits text into 2-character n-grams (bigrams), enabling fast LIKE '%keyword%' searches without full tokenization. Unlike pg_trgm (trigrams), bigrams work better for short CJK strings where trigrams produce too few matches.

Featurepg_bigmpg_trgm
n-gram size23
CJK support✅ Excellent⚠️ Limited
Short strings✅⚠️
Index typeGINGIN / GiST
Similarity search✅✅

⁠Build Your Own

git clone https://github.com/dungndinh/postgres-bigm
cd docker
./build-and-push.sh <your-dockerhub-username> --push

⁠License

Tag summary

Content type

Image

Digest

sha256:437436248…

Size

149.9 MB

Last updated

8 months ago

docker pull dungvti/postgres-bigm