There are many organizations where front/web-facing applications use MySQL and back end processing uses PostgreSQL®. Any system integration between these applications generally involves the replication—or duplication—of data from system to system. We recently blogged about pg_chameleon which can be used replicate data from MySQL® to PostgreSQL. mysql_fdw can play a key role in eliminating the problem of replicating/duplicating data. In order to eliminate maintaining the same data physically in both postgres and MySQL, we can use mysql_fdw. This allows PostgreSQL to access MySQL tables and to use them as if they are local tables in PostgreSQL. mysql_fdw can be used, too, with …
[Read more]In this post we’ll review how MySQL triggers can affect queries.
Contrary to what the documentation states, we can activate triggers even while operating on views:
https://dev.mysql.com/doc/refman/5.7/en/triggers.html
Important: MySQL triggers activate only for changes made to tables by SQL statements. They do not activate for changes in views, nor by changes to tables made by APIs that do not transmit SQL statements to the MySQL server.
Be on the lookout if you use and depend on triggers, since it’s not the case for updatable views! We have reported a documentation bug for this but figured it wouldn’t hurt to mention this as a short blog post, too. The link to the bug in question is here:
…[Read more]
PS_history is a tool which collects historical snapshots of the
PERFORMANCE_SCHEMA (P_S). This allows you to trend P_S values
over time, for example, it is possible to look at the 95 th
percentile response time for a query over time.
PS_history is stored procedure and event based, and thus it
resides entirely inside of the database with no external
dependencies. It uses a clever technique to capture all of the
P_S data in one consistent snapshot. This ensures that all of the
sys_history views (bundled now with PS_history) have a consistent
set of data.
By default, as long as the event_schedule is enabled, PS_history
will collect data every 30 seconds. If a snapshot takes 30
seconds, there will be a 30 second delay before the next snapshot
starts. This value can be changed by calling the
`ps_history`.`set_collection_interval`(N) where N is the number
of seconds between samples.
The `sys_history` schema is …
PS_history is a tool which collects historical snapshots of the
PERFORMANCE_SCHEMA (P_S). This allows you to trend P_S values
over time, for example, it is possible to look at the 95 th
percentile response time for a query over time.
PS_history is stored procedure and event based, and thus it
resides entirely inside of the database with no external
dependencies. It uses a clever technique to capture all of the
P_S data in one consistent snapshot. This ensures that all of the
sys_history views (bundled now with PS_history) have a consistent
set of data.
By default, as long as the event_schedule is enabled, PS_history
will collect data every 30 seconds. If a snapshot takes 30
seconds, there will be a 30 second delay before the next snapshot
starts. This value can be changed by calling the
`ps_history`.`set_collection_interval`(N) where N is the number
of seconds between samples.
The `sys_history` schema is …
Yesterday I was discussing with a fellow DBA about ways to check
the status of existing and/or past RMAN jobs. Good backup scripts
usually write their output to some sort of log file so, checking
the output is usually a straight-forward task. However, backup
jobs can be scheduled in many different ways (crontab, Grid
Control, Scheduled Tasks, etc) and finding the log file may be
tricky if you don’t know the environment well.
Furthermore, log files may also have already been overwritten by
the next backup or simply just deleted. An alternative way of
accessing that information, thus, may come handy.
Fortunately, RMAN keeps the backup metadata around for some time and it can be accessed through the database’s V$ views. Obviously, if you need this information because your database just crashed and needs to be restored, the method described here is useless.
Backup jobs’ status and metadata
A lot of metadata about …
[Read more]The most basic and most oft-repeated task that a DBA has to accomplish is to look at slow logs and filter out queries that are suboptimal, that consume lots of unnecessary resources and that hence slow down the database server. This post looks at why and how VIEWs can help against such suboptimal operations.
Views in MySQL really has quite a bad reputation, for bad
performance mainly, but also there were some stability issues at
some point. Now they are pretty stable, but I don't see them used
that much. One place where I like to use them myself is in
combination with INFORMATION_SCHEMA tables. The I_S tables are
really useful and contain a lot of information, and by using
VIEWs we can massage the data a bit.
I often have a database specifcally for DBA needs, so that is
what we will use here.
CREATE DATABASE IF NOT EXISTS dba;
USE dba;
OK, now we have a database to play with. Lets solve a minor
problem first. Being able to use the TABLES table in
INFORMATION_SCHEMA is great, as it allows standard SQL filtering
and processing, in difference to the output from SHOW TABLES
(largely at least, some filtering is available in the SHOW
commands also of course). But the TABLES table contains the
tables in ALL …
In a previous article, I've already talked about an optimized way to connect locations in a geographic point of view by using MySQL. In this manner, locations of pubs, drugstores, barbers or even users can be obtained. Communities, or perhaps I should use the newer term Social Networks, make use of the buddy network of indiviual members in addition to the geographical mapping. This has many psychological advantages, because new members can be integrated in an established network very easily and I'm more willing to become involved when I already know some of the members.
By now you know that there is a MySQL Track during next week’s ODTUG Kaleidoscope in Washington, DC. Ronald Bradford and I organized the schedule at the last minute (Ronald did a lot of the work!). It was difficult to fill a schedule with 19 sessions that are either 1 hour or 1.5 hours long, and to do it I ended up with three presentations.
At each presentation I will be giving away a copy of The MySQL Administrator’s Bible, so be sure to show up! All MySQL track sessions are in Maryland C, and all times are Eastern.
On Monday, June 28th from 4 pm – 5:30 pm I will be presenting …
[Read more]It may sound like a dramatic number, and that’s because it is. One thing that is enjoyable about working on beta applications is finding new solutions and better methods to improve the user experience. The original method for displaying the recent addition of overview analytics data in the beta version of Kontrollbase was to run [...]