Tips & Tricks

Using grep to Search Output

0

The vsql \o command is typically used to send output to a file. It can also be used to pipe results to a command (\o | COMMAND). In combination with grep, output can be quickly searched. I came across this usage in the documentation and wanted to share the potential usefulness with this functionality.

Using it as the documentation suggests makes it easy to quickly identify potential areas for improvement when looking at explain plans. In the examples below, I used the UPDATE query from a recent post to search for BROADCAST network operations.

The usage in this example would be:

The explain statement comes immediately after defining

When you’re finished, just clear with \o.

In addition, this can be used to search general output. Although not really practical, it may help when trying to quickly find a pattern.

About the author / 

Norbert Krupa

Norbert is the founder of vertica.tips and a Solutions Engineer at Talend. He is an HP Accredited Solutions Expert for Vertica Big Data Solutions. He has written the Vertica Diagnostic Queries which aim to cover monitoring, diagnostics and performance tuning. The views, opinions, and thoughts expressed here do not represent those of the user's employer.

Leave a Reply

Upcoming Events

  • No upcoming events
AEC v1.0.4

Subscribe to Blog via Email

Enter your email address to subscribe and receive notifications of new posts by email.

Read more use cases here.

Notice

This site is not affiliated, endorsed or associated with HPE Vertica. This site makes no claims on ownership of trademark rights. The author contributions on this site are licensed under CC BY-SA 3.0 with attribution required.
%d bloggers like this: