<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/tag/pv/atom.xml" rel="self"/>
 <link href="http://davedash.com/tag/pv"/>
 <updated>2012-04-07T22:42:44-07:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>Getting started with pipe viewer</title>
   <link href="http://davedash.com/2009/09/16/getting-started-with-pipe-viewer/"/>
   <updated>2009-09-16T00:00:00-07:00</updated>
   <id>http://davedash.com/2009/09/16/getting-started-with-pipe-viewer</id>
   <content type="html">&lt;p&gt;Despite working on slimming the &lt;code&gt;addons.mozilla.org&lt;/code&gt; database through dieting and exercise - I still have to occasionally do long running database tasks.  So I finally tried out &lt;a href=&quot;http://www.ivarch.com/programs/pv.shtml&quot;&gt;pipe viewer&lt;/a&gt;.  As someone who's impatient this has been awesome.  Here's some quick examples:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[root@ml-db10 sun]# pv -cN source &amp;lt; addons_remora.2009.09.15.sql.gz | gunzip|pv -cN gunzip &amp;gt; addons_remora.2009.09.15.sql
   gunzip: 10.1GB 0:06:48 [25.5MB/s] [   &amp;lt;=&amp;gt;                                  ]
   source: 3.47GB 0:06:48 [8.72MB/s] [======================&amp;gt;] 100%
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we are calling pipe viewer with an argument that says to title this progress meter as &lt;code&gt;source&lt;/code&gt;, and feeding it the gzip'd file.  Pipe viewer will output two things the progress, and the actual file.  We pipe that file into &lt;code&gt;gunzip&lt;/code&gt; to unzip it, and back into another instance of pipe viewer (again with a title, of &lt;code&gt;gunzip&lt;/code&gt;) and the standard output gets redirected to our destination file.&lt;/p&gt;

&lt;p&gt;Now a simpler example is checking the progress of loading a large sql file into mysql:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[root@ml-db10 sun]# pv -cN sql &amp;lt; addons_remora.2009.09.15.sql | mysql -uroot addons_remora -p$PWD
      sql: 2.55GB 0:18:19 [5.68MB/s] [=====&amp;gt;                  ] 25% ETA 0:54:30
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We could have probably combined all this, however:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[root@ml-db10 sun]# pv -cN source &amp;lt; addons_remora.2009.09.15.sql.gz | gunzip|pv -cN gunzip | mysql -u root addons_remora -p$PWD
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Armed with this knowledge you can determine whether to grab a soda, a sandwich or a 2-hour lunch.&lt;/p&gt;
</content>
 </entry>
 

</feed>

