SlideShare a Scribd company logo
PL/Profiler
Presented by Jan Wieck, OpenSCG Inc.
What is Profiling?
“In software engineering, profiling (”program pro-
filing“,”software profiling“) is a form of dynamic
program analysis that measures, for example, the
space (memory) or time complexity of a program, the
usage of particular instructions, or the frequency and
duration of function calls. Most commonly, profiling
information serves to aid program optimization.”
– Wikipedia
Profiling PostgreSQL
• PostgreSQL can collect statistics and produce
log information that can be used by tools to
produce profiles.
• System views based on the statistics collector,
like pg_stat_user_tables, show counters per
table about the number of sequential scans and
index scans, how many tuples have been looked
up by scan type, how large the tables are etc.
• The extension pg_stat_statements collects
execution statistics for normalized queries.
Profiling PostgreSQL
• 3rd party products like pgbadger can create
extensive reports about which queries consume
most of the time and their frequency, tables,
indexes and much more.
• Unfortunately pgbadger requires extremely
aggressive query logging to be enabled in the
postgresql.conf file
(log_statement_min_duration=0), which by itself
can produce more performance problems when
you already have enough.
Profiling PostgreSQL
• On a side note: very few users perform any
profiling before they have a really bad problem in
production.
• This means that once we have a problem, there
is no baseline available to compare the current
behavior to. How do you tell what is “out of
whack” when you don’t know what used to be
“normal”?
Profiling PostgreSQL
• All of this may work to find and tune problematic
queries.
• The amount of logging often prohibits doing this
in production.
How PL/pgSQL works
• PL/pgSQL is like every other “loadable,
procedural language.”
• When a PL function is executed, the fmgr loads
the language handler and calls it.
• The language handler then interprets the
contens of the pg_proc entry for the function
(proargtypes, prorettype, prosrc).
How PL/pgSQL works
• On the first call of a function in a session, the call
handler will “compile” a function statement tree.
• SQL queries in the function are just kept as a
string at this point.
• What might look to you like an expression is
actually a SELECT query:
my_variable := some_parameter * 100;
How PL/pgSQL works
• The PL/pgSQL statement tree is very similar to a
PostgreSQL parse or execution tree.
• The call handler then executes that statement
tree.
• On the first execution of a statement node, that
has an SQL query in it, that query is prepared via
SPI.
• The prepared plan is then executed for every
invocation of that statement in the current
session.
An Example using PL/pgSQL
• The following Example is based on the
benchmarksql schema (TPC-C style)
• Like the pgbench schema (TPC-B style), the
TPC-C has a HISTORY table without any
indexes.
• The main difference is that it has more columns
and that the CUSTOMER is identified with a
3-column key.
• If we sum up the history of a customer by
selecting directly from the HISTORY table, the
query will be logged and accounted for in
pg_stat_statements.
Let there be a PL/pgSQL function
CREATE FUNCTION get_customer_balance(p_w_id integer,
p_d_id integer,
p_c_id integer)
RETURNS numeric
AS $$
DECLARE
v_balance numeric;
BEGIN
SELECT INTO v_balance sum(h_amount)
FROM bmsql_history
WHERE h_w_id = p_w_id
AND h_d_id = p_d_id
AND h_c_id = p_c_id;
RETURN v_balance;
END;
$$ LANGUAGE plpgsql;
And let there be a view using that function
CREATE OR REPLACE VIEW bmsql_problem AS
SELECT c_w_id, c_d_id, c_id,
c_balance,
get_customer_balance(c_w_id, c_d_id, c_id)
AS sum_history_amount
FROM bmsql_customer;
The Problem
• It is obvious that as the history table is growing
over time, the performance of that view will
degrade.
• Since the history table does not have an index
covering h_w_id, h_d_id, h_c_id, we will see
sequential scans on bmsql_history in
pg_stat_user_tables.
• But how do we find out where those sequential
scans are coming from?
What is captured in the logs
Application
PostgreSQL
TCOP
parse, rewrite, plan, execute
This query is loggedlibpq sends query
SELECT … FROM bmsql_problem ...
This query is logged
What isn’t captured in logs
Application
PostgreSQL
TCOP
parse, rewrite, plan, execute
libpq sends query
SELECT … FROM bmsql_problem ...
PL/pgSQL
view uses function
get_customer_balance()l
SPI_exec()
SELECT sum(h_amount) ...
This query is logged
This query
is not logged
We can see them somewhere
• pg_stat_statements.track = all
• Like with application queries you will see a
“normalized” version.
• It is no fun to hunt down that query in thousands
of lines of PL code.
• auto_explain.log_nested_statements = on
• If you have the disk space for the log and can
afford to lose 70% performance.
The Problem
• You will never see the query
SELECT sum(h_amount) FROM bmsql_history ...
in the PostgreSQL logs or pg_stat_statements.
• This example is trivial and one could easily find
the problem by looking at the view and function.
• In the real world things aren’t that simple.
In the real world …
• Customer database has 1,800 tables with 13,000
indexes used by 600 PL/pgSQL functions with
together over 100,000 lines of code.
• The application is just calling a PL/pgSQL
function, which can take anywhere from
milliseconds to hours.
• No sequential scans happened.
• Our DBAs had been working on this problem for
quite a while.
How PL profiler works
• plprofiler consists of two things.
• The plprofiler extension loaded into the backend.
• The plprofiler command line utility (Python).
• The extension uses the debug instrumentation
hooks, added to PostgreSQL in 2006 (8.2).
• The hooks invoke callbacks whenever a function
is entered/exited and whenever processing of a
PL statement (node) starts/ends.
How PL profiler works
• Using these callbacks the plprofiler extension
collects three different statistics:
1. Per call stack (call graph) the number of calls,
cumulative time spent and cumulative time spent
in all children.
2. Per function the number of calls, the cumulative
time spent in all calls to this function and the
longest time spent in a single call to this function.
3. Per statement the same as per function.
• The command line utility is using the extension to
collect data and subsequently turn it into a
detailed performance profile.
What is a call graph?
• A call graph is the current stack levels.
• Like a backtrace in a debugger (gdb bt).
• It shows where the program is executing and
how it got there.
What to do with call graphs?
• Call graphs can be turned into something really
cool. FlameGraphs!
• http://www.brendangregg.com/flamegraphs.html
• This is the first FlameGraph produced from that
customer problem.
Sorry for the blur
• Sorry for the blur, but I could not show you the
source code anyway. This was to illustrate how
things will look in the real world.
• For a simple example, let us expand on the
previous code of get_customer_balance().
• We create another function that returns the total
sum of the balances of all customers.
Another function
CREATE OR REPLACE FUNCTION total_customer_balance()
RETURNS numeric
AS $$
DECLARE
v_balance numeric = 0;
v_cust record;
BEGIN
FOR v_cust IN SELECT c_w_id, c_d_id, c_id
FROM bmsql_customer
LOOP
v_balance = v_balance +
get_customer_balance(v_cust.c_w_id,
v_cust.c_d_id,
v_cust.c_id);
END LOOP;
RETURN v_balance;
END;
$$ LANGUAGE plpgsql;
Let’s generate a report
• With that in place we execute
$ plprofiler run -d bmsql1 
--command ”select total_customer_balance()” 
--output test1.html
• This will connect to the database bmsql1, activate
the plprofiler extension, run the given query and
then produce the test1.html report.
test1.html
test1.html
• By default the report contains details for the top
10 functions by “self time”.
• This can be overridden by command line options.
• The details can be viewed by clicking on the
(show) link of one of the functions.
test1.html
Other functions of the plprofiler
• The plprofiler can not only execute a single
function. Instead of using the --command option, the
--file option can be used to execute an entire file
full of SQL statements.
• On top of that, version 3 added the ability to
profile an entire application.
Profiling the whole application
• Add plprofiler to shared_preload_libraries.
• Use the plprofiler monitor command to capture
profiling data into shared memory.
• Use the plprofiler command line utility to
generate a report.
• Save the collected data into a permanent set that
can later generate a report and/or be exported
and imported into another system.
How to get it running quickly?
• BigSQL (http://bigsql.org) has included plprofiler
version 3 in the binary distribution.
• The BigSQL Manager (BAM) has a graphical
user interface for plprofiler.
plprofiler in BAM
plprofiler in BAM
plprofiler in BAM
That is it (for now)
• Questions?
SLIDE TITLE
• SLIDE CONTENT

More Related Content

What's hot

High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
Zalando Technology
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication Cheatsheet
Alexey Lesovsky
 
Как PostgreSQL работает с диском
Как PostgreSQL работает с дискомКак PostgreSQL работает с диском
Как PostgreSQL работает с диском
PostgreSQL-Consulting
 
Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2
Alexander Shulgin
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 
nginx: writing your first module
nginx: writing your first modulenginx: writing your first module
nginx: writing your first module
redivy
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
Denish Patel
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Ontico
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
PostgreSQL Terminology
PostgreSQL TerminologyPostgreSQL Terminology
PostgreSQL Terminology
Showmax Engineering
 
Managing PostgreSQL with PgCenter
Managing PostgreSQL with PgCenterManaging PostgreSQL with PgCenter
Managing PostgreSQL with PgCenter
Alexey Lesovsky
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
Ontico
 
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Gulcin Yildirim Jelinek
 
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
Ontico
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenter
Alexey Lesovsky
 
XtraDB 5.7: key performance algorithms
XtraDB 5.7: key performance algorithmsXtraDB 5.7: key performance algorithms
XtraDB 5.7: key performance algorithms
Laurynas Biveinis
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
Denish Patel
 
HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)
akirahiguchi
 
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
Ontico
 

What's hot (20)

High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication Cheatsheet
 
Как PostgreSQL работает с диском
Как PostgreSQL работает с дискомКак PostgreSQL работает с диском
Как PostgreSQL работает с диском
 
Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
 
nginx: writing your first module
nginx: writing your first modulenginx: writing your first module
nginx: writing your first module
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
PostgreSQL Terminology
PostgreSQL TerminologyPostgreSQL Terminology
PostgreSQL Terminology
 
Managing PostgreSQL with PgCenter
Managing PostgreSQL with PgCenterManaging PostgreSQL with PgCenter
Managing PostgreSQL with PgCenter
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
 
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
 
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
Как мы сделали PHP 7 в два раза быстрее PHP 5 / Дмитрий Стогов (Zend Technolo...
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenter
 
XtraDB 5.7: key performance algorithms
XtraDB 5.7: key performance algorithmsXtraDB 5.7: key performance algorithms
XtraDB 5.7: key performance algorithms
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
 
HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)
 
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
Testing applications with traffic control in containers / Alban Crequy (Kinvolk)
 

Viewers also liked

Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
Ontico
 
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
Ontico
 
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
Ontico
 
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
Ontico
 
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
Ontico
 
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
Ontico
 
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
Ontico
 
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
Ontico
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Ontico
 
Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
 Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo) Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
Ontico
 
Хранение данных на виниле / Константин Осипов (tarantool.org)
Хранение данных на виниле / Константин Осипов (tarantool.org)Хранение данных на виниле / Константин Осипов (tarantool.org)
Хранение данных на виниле / Константин Осипов (tarantool.org)
Ontico
 
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
Ontico
 
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
Ontico
 
Долгожданный релиз pg_pathman 1.0 / Александр Коротков, Дмитрий Иванов (Post...
Долгожданный релиз pg_pathman 1.0 / Александр Коротков,  Дмитрий Иванов (Post...Долгожданный релиз pg_pathman 1.0 / Александр Коротков,  Дмитрий Иванов (Post...
Долгожданный релиз pg_pathman 1.0 / Александр Коротков, Дмитрий Иванов (Post...
Ontico
 
NoSQL внутри SQL: приземленные вопросы практического применения / Дмитрий До...
NoSQL внутри SQL: приземленные вопросы практического применения /  Дмитрий До...NoSQL внутри SQL: приземленные вопросы практического применения /  Дмитрий До...
NoSQL внутри SQL: приземленные вопросы практического применения / Дмитрий До...
Ontico
 
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
Ontico
 
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
Ontico
 
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
Ontico
 
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
Ontico
 
Эффективная отладка репликации MySQL / Света Смирнова (Percona)
Эффективная отладка репликации MySQL / Света Смирнова (Percona)Эффективная отладка репликации MySQL / Света Смирнова (Percona)
Эффективная отладка репликации MySQL / Света Смирнова (Percona)
Ontico
 

Viewers also liked (20)

Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
Archival Disc на смену Blu-ray: построение архивного хранилища на оптических ...
 
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
 
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
Сегментируем 600 млн. пользователей в режиме реального времени каждый день. H...
 
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
Отказоустойчивая обработка 10M OAuth токенов на Tarantool / Владимир Перепели...
 
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
Виртуальный ЦОД для корпоративных клиентов на базе Virtuozzo: стабильность, п...
 
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
Мастер-класс "Микросервисы: удобно, надежно, серебрянопульно" / Евгений Павло...
 
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
Микросервисы: опыт использования в нагруженном проекте / Вадим Мадисон (М-Тех)
 
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
Open Source SQL-базы данных вступили в эру миллионов запросов в секунду / Фед...
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
 
Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
 Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo) Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
Отладка производительности приложения на Erlang / Максим Лапшин (Erlyvideo)
 
Хранение данных на виниле / Константин Осипов (tarantool.org)
Хранение данных на виниле / Константин Осипов (tarantool.org)Хранение данных на виниле / Константин Осипов (tarantool.org)
Хранение данных на виниле / Константин Осипов (tarantool.org)
 
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
Профилирование кода на C/C++ в *nix-системах / Александр Алексеев (Postgres P...
 
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
Как смигрировать 50Пб в 32 без даунтайма? / Альберт Галимов, Андрей Сумин (Ma...
 
Долгожданный релиз pg_pathman 1.0 / Александр Коротков, Дмитрий Иванов (Post...
Долгожданный релиз pg_pathman 1.0 / Александр Коротков,  Дмитрий Иванов (Post...Долгожданный релиз pg_pathman 1.0 / Александр Коротков,  Дмитрий Иванов (Post...
Долгожданный релиз pg_pathman 1.0 / Александр Коротков, Дмитрий Иванов (Post...
 
NoSQL внутри SQL: приземленные вопросы практического применения / Дмитрий До...
NoSQL внутри SQL: приземленные вопросы практического применения /  Дмитрий До...NoSQL внутри SQL: приземленные вопросы практического применения /  Дмитрий До...
NoSQL внутри SQL: приземленные вопросы практического применения / Дмитрий До...
 
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
Девять кругов ада или PostgreSQL Vacuum / Алексей Лесовский (PostgreSQL-Consu...
 
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
LuaJIT как основа для сервера приложений - проблемы и решения / Игорь Эрлих (...
 
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
Выбираем СУБД для хранения временных рядов / Павел Филонов (Лаборатория Каспе...
 
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
Разработка real-time приложений с RethinkDB / Илья Вербицкий (Независимый кон...
 
Эффективная отладка репликации MySQL / Света Смирнова (Percona)
Эффективная отладка репликации MySQL / Света Смирнова (Percona)Эффективная отладка репликации MySQL / Света Смирнова (Percona)
Эффективная отладка репликации MySQL / Света Смирнова (Percona)
 

Similar to Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck (OpenSCG)

PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and Alerting
Grant Fritchey
 
What you need to know for postgresql operation
What you need to know for postgresql operationWhat you need to know for postgresql operation
What you need to know for postgresql operation
Anton Bushmelev
 
Hadoop cluster performance profiler
Hadoop cluster performance profilerHadoop cluster performance profiler
Hadoop cluster performance profiler
Ihor Bobak
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation
Biju Thomas
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
Stefan Krawczyk
 
Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahu
Dr. Prakash Sahu
 
Oracle Query Optimizer - An Introduction
Oracle Query Optimizer - An IntroductionOracle Query Optimizer - An Introduction
Oracle Query Optimizer - An Introduction
adryanbub
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Command Prompt., Inc
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
PROIDEA
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
Jakub Hajek
 
Introduction to Structured Streaming
Introduction to Structured StreamingIntroduction to Structured Streaming
Introduction to Structured Streaming
Knoldus Inc.
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluation
avniS
 
Creating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at ScaleCreating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at Scale
Sean Chittenden
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
VAIBHAVKADAGANCHI
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + Optimization
MongoDB
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
PgTraining
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
MongoDB
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
Iván Fernández Perea
 
query_tuning.pdf
query_tuning.pdfquery_tuning.pdf
query_tuning.pdf
ssuserf99076
 

Similar to Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck (OpenSCG) (20)

PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and Alerting
 
What you need to know for postgresql operation
What you need to know for postgresql operationWhat you need to know for postgresql operation
What you need to know for postgresql operation
 
Hadoop cluster performance profiler
Hadoop cluster performance profilerHadoop cluster performance profiler
Hadoop cluster performance profiler
 
2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation2013 Collaborate - OAUG - Presentation
2013 Collaborate - OAUG - Presentation
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahu
 
Oracle Query Optimizer - An Introduction
Oracle Query Optimizer - An IntroductionOracle Query Optimizer - An Introduction
Oracle Query Optimizer - An Introduction
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
Introduction to Structured Streaming
Introduction to Structured StreamingIntroduction to Structured Streaming
Introduction to Structured Streaming
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluation
 
Creating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at ScaleCreating PostgreSQL-as-a-Service at Scale
Creating PostgreSQL-as-a-Service at Scale
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + Optimization
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
 
query_tuning.pdf
query_tuning.pdfquery_tuning.pdf
query_tuning.pdf
 

More from Ontico

One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
Ontico
 
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Ontico
 
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Ontico
 
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Ontico
 
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Ontico
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Ontico
 
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Ontico
 
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
Ontico
 
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
Ontico
 
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Ontico
 
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Ontico
 
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Ontico
 
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Ontico
 
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
Ontico
 
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Ontico
 
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Ontico
 
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
Ontico
 
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Ontico
 
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Ontico
 
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
Ontico
 

More from Ontico (20)

One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
 
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
 
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
 
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
 
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
 
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
 
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
 
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
 
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
 
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
 
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
 
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
 
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
 
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
 
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
 
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
 
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
 
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
 
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
Как мы учились чинить самолеты в воздухе / Евгений Коломеец (Virtuozzo)
 

Recently uploaded

一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
q30122000
 
P5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civilP5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civil
AnasAhmadNoor
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
vmspraneeth
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Transcat
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
PreethaV16
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
abdatawakjira
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
ijaia
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
Kamal Acharya
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 

Recently uploaded (20)

一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
 
P5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civilP5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civil
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 

Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck (OpenSCG)

  • 1. PL/Profiler Presented by Jan Wieck, OpenSCG Inc.
  • 2. What is Profiling? “In software engineering, profiling (”program pro- filing“,”software profiling“) is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. Most commonly, profiling information serves to aid program optimization.” – Wikipedia
  • 3. Profiling PostgreSQL • PostgreSQL can collect statistics and produce log information that can be used by tools to produce profiles. • System views based on the statistics collector, like pg_stat_user_tables, show counters per table about the number of sequential scans and index scans, how many tuples have been looked up by scan type, how large the tables are etc. • The extension pg_stat_statements collects execution statistics for normalized queries.
  • 4. Profiling PostgreSQL • 3rd party products like pgbadger can create extensive reports about which queries consume most of the time and their frequency, tables, indexes and much more. • Unfortunately pgbadger requires extremely aggressive query logging to be enabled in the postgresql.conf file (log_statement_min_duration=0), which by itself can produce more performance problems when you already have enough.
  • 5. Profiling PostgreSQL • On a side note: very few users perform any profiling before they have a really bad problem in production. • This means that once we have a problem, there is no baseline available to compare the current behavior to. How do you tell what is “out of whack” when you don’t know what used to be “normal”?
  • 6. Profiling PostgreSQL • All of this may work to find and tune problematic queries. • The amount of logging often prohibits doing this in production.
  • 7. How PL/pgSQL works • PL/pgSQL is like every other “loadable, procedural language.” • When a PL function is executed, the fmgr loads the language handler and calls it. • The language handler then interprets the contens of the pg_proc entry for the function (proargtypes, prorettype, prosrc).
  • 8. How PL/pgSQL works • On the first call of a function in a session, the call handler will “compile” a function statement tree. • SQL queries in the function are just kept as a string at this point. • What might look to you like an expression is actually a SELECT query: my_variable := some_parameter * 100;
  • 9. How PL/pgSQL works • The PL/pgSQL statement tree is very similar to a PostgreSQL parse or execution tree. • The call handler then executes that statement tree. • On the first execution of a statement node, that has an SQL query in it, that query is prepared via SPI. • The prepared plan is then executed for every invocation of that statement in the current session.
  • 10. An Example using PL/pgSQL • The following Example is based on the benchmarksql schema (TPC-C style) • Like the pgbench schema (TPC-B style), the TPC-C has a HISTORY table without any indexes. • The main difference is that it has more columns and that the CUSTOMER is identified with a 3-column key. • If we sum up the history of a customer by selecting directly from the HISTORY table, the query will be logged and accounted for in pg_stat_statements.
  • 11. Let there be a PL/pgSQL function CREATE FUNCTION get_customer_balance(p_w_id integer, p_d_id integer, p_c_id integer) RETURNS numeric AS $$ DECLARE v_balance numeric; BEGIN SELECT INTO v_balance sum(h_amount) FROM bmsql_history WHERE h_w_id = p_w_id AND h_d_id = p_d_id AND h_c_id = p_c_id; RETURN v_balance; END; $$ LANGUAGE plpgsql;
  • 12. And let there be a view using that function CREATE OR REPLACE VIEW bmsql_problem AS SELECT c_w_id, c_d_id, c_id, c_balance, get_customer_balance(c_w_id, c_d_id, c_id) AS sum_history_amount FROM bmsql_customer;
  • 13. The Problem • It is obvious that as the history table is growing over time, the performance of that view will degrade. • Since the history table does not have an index covering h_w_id, h_d_id, h_c_id, we will see sequential scans on bmsql_history in pg_stat_user_tables. • But how do we find out where those sequential scans are coming from?
  • 14. What is captured in the logs Application PostgreSQL TCOP parse, rewrite, plan, execute This query is loggedlibpq sends query SELECT … FROM bmsql_problem ... This query is logged
  • 15. What isn’t captured in logs Application PostgreSQL TCOP parse, rewrite, plan, execute libpq sends query SELECT … FROM bmsql_problem ... PL/pgSQL view uses function get_customer_balance()l SPI_exec() SELECT sum(h_amount) ... This query is logged This query is not logged
  • 16. We can see them somewhere • pg_stat_statements.track = all • Like with application queries you will see a “normalized” version. • It is no fun to hunt down that query in thousands of lines of PL code. • auto_explain.log_nested_statements = on • If you have the disk space for the log and can afford to lose 70% performance.
  • 17. The Problem • You will never see the query SELECT sum(h_amount) FROM bmsql_history ... in the PostgreSQL logs or pg_stat_statements. • This example is trivial and one could easily find the problem by looking at the view and function. • In the real world things aren’t that simple.
  • 18. In the real world … • Customer database has 1,800 tables with 13,000 indexes used by 600 PL/pgSQL functions with together over 100,000 lines of code. • The application is just calling a PL/pgSQL function, which can take anywhere from milliseconds to hours. • No sequential scans happened. • Our DBAs had been working on this problem for quite a while.
  • 19. How PL profiler works • plprofiler consists of two things. • The plprofiler extension loaded into the backend. • The plprofiler command line utility (Python). • The extension uses the debug instrumentation hooks, added to PostgreSQL in 2006 (8.2). • The hooks invoke callbacks whenever a function is entered/exited and whenever processing of a PL statement (node) starts/ends.
  • 20. How PL profiler works • Using these callbacks the plprofiler extension collects three different statistics: 1. Per call stack (call graph) the number of calls, cumulative time spent and cumulative time spent in all children. 2. Per function the number of calls, the cumulative time spent in all calls to this function and the longest time spent in a single call to this function. 3. Per statement the same as per function. • The command line utility is using the extension to collect data and subsequently turn it into a detailed performance profile.
  • 21. What is a call graph? • A call graph is the current stack levels. • Like a backtrace in a debugger (gdb bt). • It shows where the program is executing and how it got there.
  • 22. What to do with call graphs? • Call graphs can be turned into something really cool. FlameGraphs! • http://www.brendangregg.com/flamegraphs.html • This is the first FlameGraph produced from that customer problem.
  • 23. Sorry for the blur • Sorry for the blur, but I could not show you the source code anyway. This was to illustrate how things will look in the real world. • For a simple example, let us expand on the previous code of get_customer_balance(). • We create another function that returns the total sum of the balances of all customers.
  • 24. Another function CREATE OR REPLACE FUNCTION total_customer_balance() RETURNS numeric AS $$ DECLARE v_balance numeric = 0; v_cust record; BEGIN FOR v_cust IN SELECT c_w_id, c_d_id, c_id FROM bmsql_customer LOOP v_balance = v_balance + get_customer_balance(v_cust.c_w_id, v_cust.c_d_id, v_cust.c_id); END LOOP; RETURN v_balance; END; $$ LANGUAGE plpgsql;
  • 25. Let’s generate a report • With that in place we execute $ plprofiler run -d bmsql1 --command ”select total_customer_balance()” --output test1.html • This will connect to the database bmsql1, activate the plprofiler extension, run the given query and then produce the test1.html report.
  • 27. test1.html • By default the report contains details for the top 10 functions by “self time”. • This can be overridden by command line options. • The details can be viewed by clicking on the (show) link of one of the functions.
  • 29. Other functions of the plprofiler • The plprofiler can not only execute a single function. Instead of using the --command option, the --file option can be used to execute an entire file full of SQL statements. • On top of that, version 3 added the ability to profile an entire application.
  • 30. Profiling the whole application • Add plprofiler to shared_preload_libraries. • Use the plprofiler monitor command to capture profiling data into shared memory. • Use the plprofiler command line utility to generate a report. • Save the collected data into a permanent set that can later generate a report and/or be exported and imported into another system.
  • 31. How to get it running quickly? • BigSQL (http://bigsql.org) has included plprofiler version 3 in the binary distribution. • The BigSQL Manager (BAM) has a graphical user interface for plprofiler.
  • 35. That is it (for now) • Questions?