Miroslav Šedivý
Miroslav Šedivý solute GmbH
16:30 04 February
90 мин

Asynchronous Python and PostgreSQL Using asyncpg

Python may not be the fastest programming language on the CPU, but its fast and easy development saves a lot of costs between the keyboard and the chair. Since database clients spend most of their time waiting for a response from the database server, Python's asynchronous functionality available in the recent versions (3.5+) may help to optimize the application's runtime considerably by working on something else while server's response is being prepared. The asynchronous interface between Python and PostgreSQL is called "asyncpg". In the workshop we'll explore this library and write a short application using some of its useful features.


Другие доклады

  • Nikolay Samokhvalov
    Nikolay Samokhvalov Nombox LLC
    45 мин

    Enterprise-level approach to PostgreSQL tuning: database experiments

    Shared_buffers = 25% – is it too much or not enough? Or it's the right value?

    How can we ensure that this – pretty much outdated – recommendation suit well our needs?

    It is time to start apply enterprise-level approach to tuning postgresql.conf. Not using various blind auto-tuners or advices from old articles and blog posts, but based on the following two aspects:

    1. comprehensive database experiments, conducted in automated fashion, repeated multiple times in conditions as close to production as possible, and
    2. deep understanding of DBMS and OS internals.

    Using Nancy CLI (https://gitlab.com/postgres.ai/nancy) we will consider a concrete example: infamous shared_buffers, under various circumstances, in various projects. We will try to figure out, how to optimize this settings for given infrastructure, database, and workload.

  • Andrey Fefelov
    Andrey Fefelov Mastery.pro
    45 мин

    How and what we'd choose between patroni, stolon, repmgr for out HA Postgres

    While doing development of one of our project we were asked to build HA database using Postgres, geographically distributed.

    First our choice was obvious, we started to work with big 3 cloud providers, but soon it was quite understand that everything costs big enough for us. Also there were a bunch of incompatibilities with unsupported extensions as well as londiste replication we were heavily used.

    I will talk about why we chose patroni, what types of problem we faced with and patroni's special features can dramatically simplify deploy and everyday usage.

  • Miroslav Šedivý
    Miroslav Šedivý solute GmbH
    45 мин

    Bitemporality: Tracking Reproducible Revisions in PostgreSQL Using RANGE Types

    So you finally have your database model for your application and you fill it in with current data. How do you keep it up to date? While INSERT may still be transparent, UPDATE and DELETE will overwrite your previous data, so you won't be able to reproduce them. Cloning the whole huge content for each minor update is not an option. For rich and complex data about hundreds of thousands of power generators in Germany and worldwide, I built a model using range data types in recent PostgreSQL which allows me to insert, update and delete data while granting the full access to the whole state of the database at any historical moment. I'll present a very simplified version of the database so the audience will be immediately able to apply it for their cases. I'll also show a few tricks in Python and Psycopg2 that will allow a whole team to prepare, review, and deploy all revisions to this database without merge conflicts. And I'll give a few ideas on how to retrieve this data efficiently.

  • Piotr Jarmuż
    Piotr Jarmuż Allegro sp. z.o.o
    45 мин

    Hacking with Postgres 11 - pg_threads

    My presentation is about writing extensions in Postgres. I have written pg_threads that implements simplified POSIX thread API inside Postgres database. It adds a new powerful abstraction giving database developers new opportunities for writing parallel code thus taking advantage of multicore CPUs. There is an extra API for transactional and non-transactional IPC between threads. I also have an example application that takes advantage of this new API that scales linearly even across 2 nodes. The presentation is with live working demo using vagrant project with 2 VMs running Ubuntu and 2 Postgres 11 databases.