Showing posts with label aggregate functions. Show all posts
Showing posts with label aggregate functions. Show all posts

Friday, 21 September 2012

[Перевод] Почему я отказался от MongoDB

Не так давно я закончил миграцию одного из наших проектов с MongoDB на PostgreSQL. Я бы хотел поделится почему я принял такое решение.

По правде говоря, мое решение использовать MongoDB нельзя считать хорошо продуманным. Урок усвоен - тщательно исследуйте любую новую технологию, которую вы внедряете в ваш рабочий стек, при этом отлично понимая все её сильные и слабые стороны и убедитесь, что вы кристально честно оцениваете - подходит ли она вашим нуждам или нет, независимо от того как её нахваливают. Ниже не будут описаны обычные жалобы на MongoDB, такие как порча данных, глобальная блокировка записи, конфигурация шардов и тому подобное. В наших сценариях использования MongoDB обманула наши ожидания на более простом уровне.

Sunday, 25 September 2011

Magic of window functions in PostgreSQL

Once I had an opportunity to provide a solution generating "everyday" statistic of game service usage by users perfectly presented by the maximum amount of game points each user had every 24 hours. The most convenient way to show that data anyone who concerns is a graphical chart showing variations of gained points within predefined ranges.

Historically the only raw data we had at the moment was the information of current number of points every time user is logged in.
The interesting part was that user does not log in every day and there was no way simple to present points flow for specified period as we wanted as there was likely to be a lot of zero values. The most suitable behaviour for this chart was to show last available value from the preceding days to fill the gaps. The easiest solution involving less coding and giving potential of reusing it in other services was PostgreSQL window functions.