All news

  • Indexes in PostgreSQL — 8 (RUM)

    | Indexes in PostgreSQL — 8 (RUM)

    We have already discussed PostgreSQL indexing engine, the interface of access methods, and main access methods, such as: hash indexes, B-trees, GiST, SP-GiST, and GIN. In this article, we will watch how gin turns into rum.


    Although the authors claim that gin is a powerful genie, the theme of drinks has eventually won: next-generation GIN has been called RUM.

    This access method expands the concept that underlies GIN and enables us to perform full-text search even faster. In this series of articles, this is the only method that is not included in a standard PostgreSQL delivery and is an external extension. Several installation options are available for it:

    • Take "yum" or "apt" package from the PGDG repository. For example, if you installed PostgreSQL from "postgresql-10" package, also install "postgresql-10-rum".
    • Build from source code on github and install on your own (the instruction is there as well).
    • Use as a part of Postgres Pro Enterprise (or at least read the documentation from there).

    Limitations of GIN

    What limitations of GIN does RUM enable us to transcend?

    First, "tsvector" data type contains not only lexemes, but also information on their positions inside the document. As we observed last time, GIN index does not store this information. For this reason, operations to search for phrases, which appeared in version 9.6, are supported by GIN index inefficiently and have to access the original data for recheck.

    Second, search systems usually return the results sorted by relevance (whatever that means). We can use ranking functions "ts_rank" and "ts_rank_cd" to this end, but they have to be computed for each row of the result, which is certainly slow.

    To a first approximation, RUM access method can be considered as GIN that additionally stores position information and can return the results in a needed order (like GiST can return nearest neighbors). Let's move step by step.

  • Indexes in PostgreSQL — 7 (GIN)

    | Indexes in PostgreSQL — 7 (GIN)

    We have already got acquainted with PostgreSQL indexing engine and the interface of access methods and discussed hash indexes, B-trees, as well as GiST and SP-GiST indexes. And this article will feature GIN index.


    "Gin?.. Gin is, it seems, such an American liquor?.."
    "I'm not a drink, oh, inquisitive boy!" again the old man flared up, again he realized himself and again took himself in hand. "I am not a drink, but a powerful and undaunted spirit, and there is no such magic in the world that I would not be able to do."

    — Lazar Lagin, "Old Khottabych".

    Gin stands for Generalized Inverted Index and should be considered as a genie, not a drink.

    General concept

    GIN is the abbreviated Generalized Inverted Index. This is a so-called inverted index. It manipulates data types whose values are not atomic, but consist of elements. We will call these types compound. And these are not the values that get indexed, but individual elements; each element references the values in which it occurs.

    A good analogy to this method is the index at the end of a book, which for each term, provides a list of pages where this term occurs. The access method must ensure fast search of indexed elements, just like the index in a book. Therefore, these elements are stored as a familiar B-tree (a different, simpler, implementation is used for it, but it does not matter in this case). An ordered set of references to table rows that contain compound values with the element is linked to each element. Orderliness is inessential for data retrieval (the sort order of TIDs does not mean much), but important for the internal structure of the index.

  • Storing arbitrary PostgreSQL data types in JSONB

    | Storing arbitrary PostgreSQL data types in JSONB

    Last month Alvaro Hernandez-Tortosa published a blog post discussing how the existing JSON features in PostgreSQL can be improved. The main request was about increasing the number of data types supported in JSONB. We addressed this concern and are ready to share our development team’s commentary.


  • JsQuery

    JsQuery – is a language to query jsonb data type, introduced in PostgreSQL release 9.4. It's primary goal is to provide an additional functionality to jsonb (currently missing in PostgreSQL), such as a simple and effective way to search in nested objects and arrays, more comparison operators with indexes support.

  • pg_variables

    Functions for defining and using variables in client sessions.

  • pg_probackup

    Pg_probackup is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure.

  • mamonsu

    An active monitoring agent for Postgres Pro. Based on zabbix, mamonsu provides an extensible cross-platform solution that can collect and visualize multiple Postgres Pro and system metrics.

Postgres Extensions

  • Backup

    We work on several backup problems: block-level incremental backup, backup validation, partial backup/restore.

  • Connection pooling

    Working with large number of simultaneous connections almost inevitably leads to usage of connection pools. Unfortunately, present pooling solutions are very limited in access to all PostgreSQL features.

  • Pluggable storages

    We achieved a significant progress in PostgreSQL extendability: FDWs, custom access methods, generic WAL. And we’re not so far from having pluggable storage engines. Concept of API was presented at PGCon 2016.




Postgres Professional

Postgres Professional is the Russian PostgreSQL company founded by Russian PostgreSQL contributors. Company has 50+ employees, among them three Major PostgreSQL Contributors.

Postgres Professional is an active member of international PostgreSQL community, developers had committed 93 patches to the latest release of PostgreSQL 10.0.

Our company had successfully performed large PostgreSQL projects including database migration projects for well-known Russian and international companies. We provide industrial PostgreSQL services: vendor technical support, migration, custom extensions and core patches development, migration-related consulting, training and certification.