Vertica and K-Safety

So you probably know that I have been working with HP’s Vertica. I’m very glad that I had this opportunity to interact with something like this. The technology behind it is pretty new and immature and lacks the power of PL/SQL but the speed that it achieves through massive parallel execution of queries is simply amazing. I don’t know if you have heard of the term K-Safe or K-Safety. When I first heard it, I had no idea what it was. Then after going through some of the documentation I kind of got the point. ...

November 6, 2013 · 2 min · 382 words

SQuirreL graphical user interface for Vertica

Hey guys, I tried out DBVisualizer earlier. I liked it and I have blogged about setting that up for your Vertica database. But it is expensive. I mean I can’t buy it for my personal use unless a company actually sponsors me. I’m a poor developer you see. So I searched for alternatives and I kind of liked SQuirrel SQL client. It is a java based open source SQL client which is pretty awesome. First you should go and download it to know what I mean: http://squirrel-sql.sourceforge.net/. ...

September 24, 2013 · 5 min · 1030 words

Vertica Query Performance Tuning - An introduction

Hey there, I guess you have been having a lot fun with your Vertica databases. I thought I’d share some of the things that I did to improve my query performance. Tables and Projections in Vertica In Vertica even though we access data through tables everything is stored in projections which are stored among nodes in various ways depending on the K Safety and the Segmentation options that we choose when creating the table. We can make modifications to these projections manually or run the Database Designer to generate projections for us. Sometimes to get the best performance we have to write query specific projections. ...

September 12, 2013 · 5 min · 915 words

Vertica and its version - Find out using SQL

I was playing around with Vertica and my friend suddenly asked me what version of Vertica I was using. This was because he was trying to debug something and posted a question to guys from Vertica and they asked him that question. At my workplace we use the same Vertica cluster for development. It is a playground with a lot of restrictions. Without DB Admin access you can’t really explore much in Vertica. But yea we are trying to get the most out it despite all that. ...

June 24, 2013 · 1 min · 167 words

Exploring Vertica's INTERPOLATE predicate

Vertica has a special feature to join tables and fill in the last available values where values would otherwise be null. I had a similar use case and wanted to test how I could make the best use of it. I played with simple examples and got it right, but with a slightly more complex one, I was stuck or maybe I just couldn’t understand what was happening. So I posted a question at Stackoverflow ...

June 18, 2013 · 1 min · 75 words

Vertica - Calendar table with dates from a start date to an end date using analytical SQL

I had a problem creating a table with just SQL that is supported by Vertica. Most of the solutions that I came across online were using procedures. But after a lot of playing around and reading vertica documentation I found a solution to my problem. read more about the problem and the solution at Stackoverflow

June 18, 2013 · 1 min · 55 words

Viewing function definitions in Vertica

I don’t know if you have tried this. But I did try to read function definition from the system tables in Vertica. I used the table called USER_FUNCTIONS which is a table in the V_CATALOG system schema. More details can be found here: https://my.vertica.com/docs/6.1.x/HTML/index.htm#15021.htm But unfortunately when I try and do something like this: vertdeva01:20130604-113434 > select function\_definition from v\_catalog.user\_functions where schema\_name='calc' and function\_name='getCYForDate'; \---------------------------------------------------------------------------------------------------------------------------------- RETURN to\_date(concat(((((date\_part('year', (processDate)::timestamp))::int - CASE WHEN ((date\_part('month', (processDate)::time (1 row) If you notice the function definition is only partly visible. The rest of it gets truncated. I don’t know how to set it right. If you know how, feel free to comment on this post. ...

June 5, 2013 · 2 min · 267 words

Setup DBVisualizer with an HP Vertica DB connection

Download your free copy of DBVisualizer from http://www.dbvis.com/download/ I am going to give you the steps to setup vertica connection to DB Visualizer on a windows 7. Our windows might look different. But I suppose the terms used on the GUI would match that on any operating system. I know this might be a big assumption as I don’t work for DBVisualizer and I haven’t installed it on any other platform. But it is always worth giving this a try if you are starting to use Vertica and would like to see your tables and write queries on a GUI based environment. I am not a big fan of GUIs. But some times it might become handy. Especially if you are a DBA and you manage quite a lot of databases. ...

June 5, 2013 · 4 min · 798 words

Vertica DELETE columns from one table using data from another

My colleague had an issue in Vertica. He had a set of values in table 1 to be deleted based on the records in a table table2. I didn’t think this would be easy considering VERTICA didn’t support joins when doing deletes unlike MYSQL. But they do have something else. Let me take you through the steps I followed. I created the following table in which I have records create table eakan (sec\_id int, nameid int, date date); insert into public.eakan values(1,1,'2013-05-20'); insert into public.eakan values(2,1,'2013-05-20'); insert into public.eakan values(3,1,'2013-05-20'); insert into public.eakan values(1,1,'2013-05-21'); insert into public.eakan values(2,1,'2013-05-21'); insert into public.eakan values(3,1,'2013-05-21'); ```I also created another table using the records of which I have to delete records in the earlier one.``` create table eakan\_del (sec\_id int, nameid int, date date); insert into public.eakan\_del values(1,1,'2013-05-21'); commit; ```I was naive initially and did something like this: First try:``` DELETE from eakan WHERE eakan.sec\_id IN (select eakan\_del.sec\_id from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid) and eakan.date IN (select eakan\_del.date from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid) and eakan.nameid in (select eakan\_del.nameid from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid); Then I realized there should be another way and used some documentation of Vertica and also checked out Vertica Forums if something was available. ...

May 30, 2013 · 2 min · 275 words