Thursday, August 9, 2012

PostgreSQL and Retirement Planning

If the snippet does not apply to you, then it certainly is relevant to someone that you do know.
extracted from:

Preparing for the Ultimate Vacation ( Scott Holsopple)

"Given the amount of time people spend on their vacation plans, it was alarming to see the Charles Schwab Retirement Income Study, which shows the number of people who have calculated how much income they’ll need in retirement.According to the study, 64 percent of respondents indicated they had less than one year of cash living expenses saved for retirement, and one-third of respondents said they had not even determined what their essential living expenses in retirement would be.

This study wouldn’t be so overly alarming except for the fact that the respondents were just five years away from retirement."


A dismal report, by any standard.  Nearly two-thirds that will be out of money after one year and one-third had not even determined their potential living expenses. 

It's clear that very few have any idea how much money they should have available when they do retire.  Blindfolded and walking in the direction of a known cliff.  It may be too late for the 64% group, though they may need to consider working until age 70 and receive a Delayed Retirement Credit from their Social Security Retirement.  

This series of posts will focus on those that are more than five years from retirement and still have a chance of achieving a measure of retirement security. Employers should provide these calculations for their employees as part of their ongoing Employee Communications.  Every single employee.

Younicycle includes an online database component & is built on PostgreSQL, which includes an SQL procedural language (PL/pgSQL) for creating Functions that can calculate the growth of money and use of money.  We have an built-in Editor that allows these Functions to be created online within an account.  The first Function will calculate the Future Value of a series of payments (savings).  At its simplest level, there are three factors:
  • How much you will save per period.  In this case, let's assume the period is 'per year'.
  • How many periods you will save (how many years).
  • How fast will will your money grow? (interest rate per year).
This is a simple calculation for PostgreSQL, but to get it to work efficiently for a group of employees, we need a few, basic 'objects'.
  • A Table
  • A pgSQL Function
The code below is not difficult, but would likely be created by an Application Developer, with the 'meat' in red:


CREATE OR REPLACE FUNCTION fvtestpmt(payment double precision, interestRate double precision, periods double precision)
  RETURNS double precision AS
$BODY$
 BEGIN
return payment*(pow(1+interestRate, periods)-1)/interestRate;
END;
 $BODY$
  LANGUAGE plpgsql IMMUTABLE;

The image below shows how to create this simple, but powerful Function from within Younicycle.



 But what can a Content Developer or a Human Resources Department do with this Function?  It still appears to be useless.  

In the next Post, useless will start to become useful as I'll show you how to create a Table to store Employee values and generate a Query that will apply this function to those values.

 

No comments:

Post a Comment