The following article is a bookmark of interesting queries used when discovering disk usage properties of any PostgreSQL databases. All of the queries listed here can be found in the PostgreSQL Wiki
General Table Size
This query will list out each of the tables in a given database, and show you both raw and pretty presented usage values.
Largest Database
Calcululates the size of each database; presenting databases that the user can not access as infinite in size.
Relations
The size of the tables in your database, broken down into their specific parts:
From time to time, you’ll find that some tasks could be easily achieved at the command line if you just had that one tool that you could slot in. In today’s article, I’ll take you through a few common data manipulation/mangling tools that should get you pretty productive.
head
output the first part of files
The head command will allow you to peek into a file. This is really handy when you are dealing with huge files, and you only want to sample the first n lines (or chars).
tail
output the last part of files
The tail command will allow you to sample the end of a file. tail works as head’s compliment. The --follow/-f switch is very handy with the tail command. When a file is still being written to, --follow will allow you to continaully stream the latest bytes being written to a file as they arrive.
iconv
convert text from one character encoding to another
Being able to change the character encoding of files that you’re working on can simply your processing greatly. By only needing to deal with a single encoding, you can remove this class of issue from your pipeline. A more comprehensive writeup on iconv can be found here.
tr
translate or delete characters
tr will allow you to translate your input in such a way that you can cleanse information. Translate, squeeze, and/or delete characters as the documentation says.
The [:space:] identifier user here is a special class identifier. There are support for others, too.
Identifier
Description
[:alnum:]
all letters and digits
[:alpha:]
all letters
[:blank:]
all horizontal whitespace
[:cntrl:]
all control characters
[:digit:]
all digits
[:graph:]
all printable characters, not including space
[:lower:]
all lower case letters
[:print:]
all printable characters, including space
[:punct:]
all punctuation characters
[:space:]
all horizontal or vertical whitespace
[:upper:]
all upper case letters
[:xdigit:]
all hexadecimal digits
[=CHAR=]
all characters which are equivalent to CHAR
wc
print newline, word, and byte counts for each file
Takes the input and counts things.
split
split a file into pieces
split takes a file, and cuts it into smaller pieces. This is really handy when your input file is massive; cutting the job down into smaller pieces gives you the chance to parallelize this work appropriately.
sort
sort lines of text files
The sort command will allow you to sort a text file by any column, in a couple of different ways.
uniq
report or omit repeated lines
cut
remove sections from each line of files
Cutting columns from your file can be useful if you need to trim information from your data source prior to moving to the next phase of your pipeline.
paste
merge lines of files
The paste command takes multiple files, and links each line of data together.
These values can be pasted together:
The output of which would look like this:
join
join lines of two files on a common field
The join command will run a fairly basic INNER JOIN between two files. One column from each file will be chosen, and a strong join performed leaving you with the coninciding set.
grep, sed, and awk
Each of these commands really needs their own articles. They are full programming tools in their own right.
In a world of changing software requirements, and more demand for results and analytics in realtime, framework and system creators have needed to become smarter with the way that they reason about information ingestion. Streaming frameworks have started to make good ground in establishing themselves as accessible software platforms for many developers.
In today’s article, we’ll explore RSocket very briefly. RSocket’s place is to provide an application protocol that is directly designed for reactive streaming applications.
Core Feature
The core features of implementing this specification are as follows:
Metadata and Payload frames
All 4 interaction models : Fire-and-forget, request/response, requestStream, requestChannel
Request-N frame : application level flow control
Fragmentation/Reassembly : Drivers are assumed to fully encode/decode the expected user data type
Keep-Alive frame : A responder receiving a keep-alive frame must reply a keep-alive frame
Error Frame : in order to fully support connection lifecycle
Handling the unexpected : If Resumption, Leasing or an extension is not supported, rejected error frames must be used
Example
The following are two code snippets take from the RSocket website.
In some cases, breaking your larger programming problems into smaller, parallelizable units makes sense from a time complexity problem. If the work you are trying to perform exhibits some of these parallelizable characteristics, you should only need to wait for the longest of your jobs to finish.
In today’s post, we’ll be talking about GNU Parallel.
A summary from their website:
GNU parallel is a shell tool for executing jobs in parallel using one or more computers. A job can be a single command or a small script that has to be run for each of the lines in the input. The typical input is a list of files, a list of hosts, a list of users, a list of URLs, or a list of tables. A job can also be a command that reads from a pipe. GNU parallel can then split the input and pipe it into commands in parallel.
Input
The input system is quite complex. Delimiting the inputs with the ::: operator, parallel will make a catersian product out of the input values.
Linkage is possible using :::+, should this flexibility be required.