MySQL Partitioning Tutorial

This is a brilliant power point presentation that helped summarize partitioning and its uses. I am currently working on mapping an object oriented database into a relational one, focusing on query time performance. So partitioning data according to how it is accessed was a key. And this sure helped a lot in clearing the basics, without wasting much time. hope it helps you as well. MySQL partitions tutorial ...

June 3, 2013 · 1 min · 74 words

VSQL extract data into file

Hey there! So you use Vertica and vsql to interact with your tables. Ever had those times when you wanted to take stuff from your table and paste it into Microsoft Excel for sending it off to someone not so technically acquainted with Vertica? You could write a script to do that for you. But if you just had to do it within a vsql session you also have options to do it. ...

May 30, 2013 · 1 min · 157 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

Windows Run box

Some cool windows hacks that I learned recently. Open the run command dialog box and type in the following short cuts to access the corresponding windows utilities. Accessibility Controls - access.cpl Accessibility Wizard - accwiz Add Hardware Wizard - hdwwiz.cpl Add/Remove Programs - appwiz.cpl Administrative Tools - control admintools Automatic Updates - wuaucpl.cpl Bluetooth Transfer Wizard - fsquirt Calculator - calc Certificate Manager - certmgr.msc Character Map - charmap Check Disk Utility - chkdsk Clipboard Viewer - clipbrd Command Prompt - cmd Component Services - dcomcnfg Computer Management - compmgmt.msc Control Panel - control Date and Time Properties - timedate.cpl DDE Shares - ddeshare Device Manager - devmgmt.msc Direct X Troubleshooter - dxdiag Disk Cleanup Utility - cleanmgr Disk Defragment - dfrg.msc Disk Management - diskmgmt.msc Disk Partition Manager - diskpart Display Properties - control desktop Display Properties - desk.cpl Dr. Watson System Troubleshooting­ Utility - drwtsn32 Driver Verifier Utility - verifier Event Viewer - eventvwr.msc Files and Settings Transfer Tool - migwiz File Signature Verification Tool - sigverif Findfast - findfast.cpl Firefox - firefox Folders Properties - control folders Fonts - control fonts Fonts Folder - fonts Free Cell Card Game - freecell Game Controllers - joy.cpl Group Policy Editor (for xp professional) - gpedit.msc Hearts Card Game - mshearts Help and Support - helpctr HyperTerminal - hypertrm Iexpress Wizard - iexpress Indexing Service - ciadv.msc Internet Connection Wizard - icwconn1 Internet Explorer - iexplore Internet Properties - inetcpl.cpl Keyboard Properties - control keyboard Local Security Settings - secpol.msc Local Users and Groups - lusrmgr.msc Logs You Out Of Windows - logoff Malicious Software Removal Tool - mrt Microsoft Chat - winchat Microsoft Movie Maker - moviemk Microsoft Paint - mspaint Microsoft Syncronization Tool - mobsync Minesweeper Game - winmine Mouse Properties - control mouse Mouse Properties - main.cpl Netmeeting - conf Network Connections - control netconnections Network Connections - ncpa.cpl Network Setup Wizard - netsetup.cpl Notepad - notepad Object Packager - packager ODBC Data Source Administrator - odbccp32.cpl On Screen Keyboard - osk Outlook Express - msimn Paint - pbrush Password Properties - password.cpl Performance Monitor - perfmon.msc Performance Monitor - perfmon Phone and Modem Options - telephon.cpl Phone Dialer - dialer Pinball Game - pinball Power Configuration - powercfg.cpl Printers and Faxes - control printers Printers Folder - printers Regional Settings - intl.cpl Registry Editor - regedit Registry Editor - regedit32 Remote Access Phonebook - rasphone Remote Desktop - mstsc Removable Storage - ntmsmgr.msc Removable Storage Operator Requests - ntmsoprq.msc Resultant Set of Policy (for xp professional) - rsop.msc Scanners and Cameras - sticpl.cpl Scheduled Tasks - control schedtasks Security Center - wscui.cpl Services - services.msc Shared Folders - fsmgmt.msc Shuts Down Windows - shutdown Sounds and Audio - mmsys.cpl Spider Solitare Card Game - spider SQL Client Configuration - cliconfg System Configuration Editor - sysedit System Configuration Utility - msconfig System Information - msinfo32 System Properties - sysdm.cpl Task Manager - taskmgr TCP Tester - tcptest Telnet Client - telnet User Account Management - nusrmgr.cpl Utility Manager - utilman Windows Address Book - wab Windows Address Book Import Utility - wabmig Windows Explorer - explorer Windows Firewall - firewall.cpl Windows Magnifier - magnify Windows Management Infrastructure - wmimgmt.msc Windows Media Player - wmplayer Windows Messenger - msmsgs Windows System Security Tool - syskey Windows Update Launches - wupdmgr Windows Version - winver Wordpad - write

May 7, 2013 · 3 min · 559 words

xargs saved my day

So I was doing my regular job, writing new queries to test out my team’s new databases on Vertica. And suddenly my senior manager sends out an email to all in the team asking an estimated disk space requirement for each of our work. I had to find out how much space the raw data files for a complete history that were used to load my databases occupy on disk. ...

February 6, 2013 · 6 min · 1112 words

Emacs - Copy Line

To get the equivalent of kill line command in emacs for copying purposes, I use the following code snippet. Just copy paste it in your .emacs file. (defun copy-line (arg) "Copy lines (as many as prefix argument) in the kill ring" (interactive "p") (kill-ring-save (line-beginning-position) (line-beginning-position (+ 1 arg))) (message "%d line%s copied" arg (if (= 1 arg) "" "s"))) (global-set-key "\\M-k" 'copy-line) If \C is your control key then \M is your alt key. So generally by default your kill line can be done by \C-k Now you can also copy a line by doing: \M-k I don’t remember where I got this bit of code from, I lost those tabs when Firefox crashed. ...

October 2, 2012 · 1 min · 130 words

Surrogate keys v/s natural keys

I am currently working on a database design problem. I work in the financial domain and I deal with data related to benchmarks and securities. The problem with such databases are that each security has multiple identifiers in the real world. They could be Uniquely identified by a SEDOL, CUSIP or ISIN or the many other type of identification standards available. This lead me to the question of designing the tables using a surrogate keys but I was still not sure how my team would react as they had already design loads based on real world identifiers and named it security_id. Unfortunately security_id could be a SEDOL, a CUSIP or ISIN or whatever depending on what region or benchmark the security belongs to. That isn’t really a reliable identifier. And hence to avoid annoying the guy in my team who does data loading I redesigned my queries to do some intelligent identifier resolutions. This cost us a lot. Queries that would perform in barely 500ms now take about 1500ms. ...

July 18, 2012 · 3 min · 472 words

Static in C++

Hey, its been a really long time. I couldn’t get my adsense account approved. It seems I need more content. If only I spend enough time blogging. Everyone gets busy once in a while. And everyone forgets that they have a blog. Especially ones like mine, where people rarely visit. Anyways, that’s relevant to what I wanted to make note of here. I was working on a minor change in my company’s C++ code base. Its a simple one for anyone who knows C++. But I don’t do much C++. The last time I remember writing real C++ code was during my university days. I mean my bachelors degree. During my masters I worked solely on Java based stuff for my projects and for a coursework, I just opted to do something in ASP .NET, just to get a feel of it. Coming straight back to the point. Static is an overused keyword. Literally it would mean something that doesn’t change. But in C++, this keyword has special meanings, depending on the context it is used. Static can be used for three purposes. One use is to have a variable defined that has a lifetime of the whole program. That is once you declare it static and initialize it, then that variable’s value can be accessed from anywhere in that program. That variable’s allocation is cleared up only when the program closes or quits. And it helps prevent re-initialization. If I were to write something like this: ...

July 18, 2012 · 4 min · 736 words