One funny and yet powerful idea related to one-to-one relations came to my mind recently.
Imagine a simple one-to-one relation whenever a second object always exists. For instance a user and his default virtual folder, whenever a user is created, the user’s default folder should also be created, and it cannot be deleted.
First of all a pure o-t-o relation is usually pretty useless, just add what’s needed to the table schema and skip the foreign relation part. …
English version: Simple sample for Postgres and ruby.
Что интересного в статье:
Русская версия статьи: Simple sample в ruby и Postgres’е. (рус)
Through this paper I will state N as…
English version: From Action To Any
Подкапотные нюансы AnyCable для мигрирующих с ActionCable.
Что будет интересного:
Это небольшое мемо будет интересно для тех кто хочет копнуть на полштыка…
Русская версия: От Action к Any
Internal aspects you may notice while migrating from ActionCable to AnyCable
This little memo will be useful if you want to…
How to miss a GIN index in your queries you can read in Yo-ho and the bottle of GIN. This one is example how to miss a b-tree index using varchar_pattern_ops/text_pattern_ops in non-C locale environment.
The best reallife case scenario would be an autocomplete implementation. Assume you need a fast autocompletion on some text column. User typing a text and an application delivers ten nearest words/phrases alphabetically sorted, like when you do googling.
This can be done with full text search using tsvector and ts_queries, they can do prefix search. But FTS may be highly inefficient for short piece of…
I will not give a speach about indexes in general or indexes special features in the PostgreSQL. Lets assume you know what indexes are, what is their value in delivering right amount of a needed data within a suitable amount of time. I just want to bring up a couple of interesting examples on how you can easily derail indexed behaviour in the PostgreSQL.
Lets start with a table named cards which have two columns a text title and a foreign key of collection_id.
CREATE TABLE cards (
title varchar NOT NULL,
title_tsv tsvector NOT NULL,
A reasonable way of Code-Test-Document triad organization in ruby based application with conceptions and tools overview and comparision, containing code examples.
When I was doing my first steps as C++ Win32 programmer, I was surprised how much Microsoft valued it’s documentation. MSDN documentation package was couple of times bigger than MS Visual Studio, and tech writers staff at Microsoft, as I heard, was at least as big as programmers or may be even bigger! It was some really shining etalon of how things must be done with a documentation. This was a long ago, now I’m not dealing with COM…
Since the time I discover arrays in PostgreSQL as a data type, I keep on wondering what would happend with a many to many relationship done through arrays instead of a mtm intermediate table. Of course at a scale of 100K it looks like nothing interesting, but this is a wrong assumtion, even at a scale of 100K * 100K with intence linking between objects we can see some interesting trends.
Chief Software Architect / CTO, Ruby and PostgresSQL fan.