| Showing entries 1 to 5 |
Pipe viewer is a command line tool which is used to monitor the throughput, display the estimated time of completion or to limit the transfer rate of a pipe (pipeline).
Install pipe viewer on Debian / Ubuntu with the following command.
apt-get install pv
On CentOS / Fedora / RedHat use the yum command to install pipe viewer
yum install pv
To use pipe viewer just insert the pv command between two processes to monitor the throughput of the pipe.
cat logfile.log.1 | pv | gzip -9 > logfile.log.1.gz 9,18MB 0:00:01 [ 9,1MB/s] [ <=>
Or limit the transfer rate of the pipe to a designated number of bytes.
cat logfile.log.1 | pv --rate-limit 100 | gzip -9 > logfile.log.1.gz 300B 0:00:03 [ 101B/s ] [[Read more...]
drop table if exists logs;[Read more...]
create table logs (t mediumtext) engine=innodb;
drop function if exists exceeded_logs_quota ;
create function exceeded_logs_quota()
returns boolean
deterministic
return (
select CASE
WHEN (DATA_LENGTH + INDEX_LENGTH) > (25*1024)
Dear reader, this is a challenge. How’s your MySQL prowess? You know about LIMIT: it cuts off the results at the specified number.
mysql>s; select actor_id from sakila.actor where actor_id % 5 = 0 limit 5; +----------+ | actor_id | +----------+ | 5 | | 10 | | 15 | | 20 | | 25 | +----------+ 5 rows in set (0.00 sec)
But that query actually accessed 25 rows. What if I want to say “return up to 5 rows, but don’t read any more than 20 rows to find them?”
Right now I’ve got the following:
mysql> select actor_id, @rows
-> from actor, (select @rows := 0) as x where
-> ((@rows := @rows + 1) <= 20)
-> and actor_id % 5 = 0
-> limit 5;
+----------+-------+
| actor_id | @rows |
+----------+-------+ [Read more...]
| Showing entries 1 to 5 |