Guide Area

Show MySQL import progress using Pipe Viewer

This is a short tutorial on how to show MySQL import progress using an app called Pipe Viewer. It’s very easy to install and use, but there is a few points which require explanation, so I will describe them here. I will also show examples on how to use this tool.

The Pipe Viewer’s estimated time (ETA) can be very inaccurate. You might start with 10MB/s for the first half of the import, although the second part might jump down to 500KB/s, so do not take this timer very seriously.

Installation

Installation differs based on your Linux operating system.

Linux distribution Installation procedure
Ubuntu/Debian apt-get install pv
Fedora yum install pv
CentOS/RHEL Set up ivarch YUM repository or use RepoForge, then do “yum install pv

List of all supported operating systems, together with an installation description, can be found here: https://www.ivarch.com/programs/pv.shtml

Usage

Pipe Viewer is used by adding  “pv your_sql_file.sql |”  in front of your original query. You also have to remove the ending part – sign   and everything that follows. The easiest command could look like this:

pv my_sql_file.sql | mysql -u root -h localhost -p my_database

This will append a progress bar with detailed information about your action, directly into terminal.

mysql-import-progress-pipe-viewer
http://www.tothenew.com/blog/show-status-of-mysql-imports-using-pipeviewer/

 

Vladimir Marton

DevOps Engineer focused on cloud infrastructure, automation, CI/CD and programming in Javascript, Python, PHP and SQL. Guidearea is my oldest project where I write articles about programming, marketing, SEO and others.