Aug 4, 2009

Optimizing PostgreSQL for Production ...

Optimizing PostgreSQL for Production Use.

This is a reference list of things that need to be changed to PostgreSql Server prior to production use. This material is a collection from other resources but outlined in a while to simplify configuration settings for regular database administrators like me.


STEP 1 [Configurations]: Go to PostgreSql config at: file /etc/postgresql/8.*/main/postgresql.conf to change the settings.

STEP 2 [Available Memory]: Know how much memory you need to allocate for your database. If your server is solely dedicated for database use, then your physical memory shall be your available memory. If it is shared with other services such as Apache2 Web Server then, leave an ample memory for others. Generally, allocate a very liberal amount of memory for PostgreSql since databases are naturally resource hogs. My rule of thumb for this is: 


75% of Physical Memory (RAM) = 'Available Memory'
Example: .75 * 2G RAM = [1.5 G RAM]


STEP 3 [Change th config file]

Parametershared_buffers
DescriptionSets the number of shared memory buffers used by the database server. Settings significantly higher than the minimum are usually needed for good performance. 
Units8kb
Recommended.25 * [Available Memory]
Special NoteYou need to change the kernel parameter [SHMMAX] to twice the amount of memory allocated for shared_buffers.

Parameterwork_mem
DescriptionSpecifies the amount of memory to be used by internal sort operations and hash tables before switching to temporary disk files.
Unitskb     Default: 1024kb
Recommended[Available Memory/max_connections] / 2

Parametermaintenance_work_mem
DescriptionSpecifies the maximum amount of memory to be used in maintenance operations, such as VACUUMCREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. The value is specified in kilobytes, and defaults to 16384 kilobytes (16 MB). 
Unitskb
Recommended[Available Memory] / 8

Parameterwal_buffers
DescriptionNumber of disk-page buffers allocated in shared memory for Write-Ahead Log (WAL) data.
Unitskb
Recommended8MB

Parametercheckpoint_segments
DescriptionMaximum distance between automatic WAL checkpoints, in log file segments (each segment is normally 16 megabytes). 
Units
Recommended(([Disk Space Allocation for WAL] / 8) -1 ) / 2
Special Notemust be between 16 to 128 depending on how much disk space are you willing to allocate for WAL.

Parametereffective_cache_size
DescriptionSets the planner's assumption about the effective size of the disk cache that is available to a single index scan.
Unitskb
Recommended[Available Memory] * .75

CPU Operation Costs:
cpu_tuple_cost0.0030
cpu_index_tuple_cost0.0010
cpu_operator_cost0.0005



Stumble Upon Toolbar

Jul 23, 2009

Life Insurance: Permanent vs. Term



The whole idea of getting a life insurance is purely for protection however, there are now a wide variety of life insurances, bundled with some form investments,promising better returns (cash value) and boasts wider coverage. But, before you pull your wallet and get excited please ALWAYS take time to know what you want, how much you can spare, and for how long you wish to keep the policy. Carefully selecting the right life insurance can spare you from disappoitments and save you huge sums of money in the future.

After careful deliberation, you'll surely be faced with the million dollar question - should you buy a permanent life insurance or term insurance? Here are some useful facts and tips you should consider first before buying.

1. Buy Life Insurance for Protection ONLY
Life insurance is NOT an investment vehicle and should never be considered as such. Many life insurance policies nowadays are bundled with some form of investment component that primarily makes your premium very expensive. To give you an idea, Term Life Insurance will only cost you around 10% of the actual cost you'll get from Permanent Life Insurance having the same coverage. Also, another reason worth mentioning is that investment component in permanent life insurance policies generally yields very low returns because it does not earn cash value in the first two years from your policy application.

2. Term Life: More value for less
If your young or a middle-aged dad like me, getting a term life insurance policy make alot more sense. A term life coverage at a younger age makes your premium very affordable and the likelihood of you cancelling your policy is less because it's cheap and sustainable. Fact is, many permanent life insurance policies are cancelled in the first 10 years for the very same reason.

3. Keep it lean and simple.
Do not buy some additional riders you wouldn't really need and most probably will not use. Insurance riders contain a lot of exclusions that is usually written in fine prints for very obvious reasons - they don't want you to know. Riders also drive your premium payments up and put more money into your agents pockets. The rule of thumb when getting a policy is, keep it simple and lean. The only exclusion to this rule, in my opinion, is the Waiver of Premium Rider (WoPR). This rider suspends premium payment but keeps your policy active when you become disabled.

4. Buy only from reliable source.
Always do your homework by knowing the financial standing of the insurance company you're buying a policy from. Don't be deceived by nice looking brochures or verbal promises made by your agent. Know their financial standing and get opinions from others. You have to know and make sure the company will still be there when you need them.

5. Select a professional insurance agent.
Surely, the first people who will approach you to buy their insurance are either some very close friends of yours or your relatives. My brother bought his from his mother-in-law which he eventually cancelled. My advice is stay away from them and get someone not related to you that can equally be trusted. This will make it easier for you to say no on offers you don't need or not be ashamed should you want to settle for a low-premium policy. This is one good reason why I find it difficult to cancel my policy which I bought from a close friend.

Stumble Upon Toolbar

May 17, 2009

Healthcare Reform: Things they should teach our doctors in med school.

mban1671l 

Foreword: This article was kept back for quite some time until today for the reason that it might cause a stir among many of our business partners, affiliates and a handful of close friends. I do not intend to discredit the medical profession in general nor embarrass anyone. My sole intention is to let them know that they should put people first above all before themselves.

 

Quality healthcare is one of the very basic benefit every Filipino should and always have. Yet, even those who have and can afford, cannot truly appreciate health care in its true sense of the word. I'd say, much of the problems in service delivery  lies entirely not our government or the system but from the principal drivers of health care - the doctors.

I have listed some common and very annoying habits that doctors do or doesn't do in the practice of their profession and what med schools should teach to our young graduates.

 

1. Respect other people's time.

Have you ever seen a doctor who came in for work on time? Probably there are but in my experience 9 out of 10 doctors never make it on time. What's even more disheartening is the fact that people graciously accept doctors' tardiness. No one expresses anger or disappointment whenever the doctor come in late for work. Instead, they are greeted with respect and reverence much like greeting a priest in a confessional. Also, our chronically tardy doctors were given 'safe passes' or 'blanket' acceptance for such socially unacceptable behavior. It's high time that we should express to our doctors that our time is equally important as their time and that there are no excuse good enough for disrespecting our covenant of properly keeping time.

 

2. Always consider patient's financial capacity.

The cost of health care including diagnostic tests and medicines are steep these days most specially with the advancement of very modern medical technology. Ever wonder why doctors prescribe too many lab tests and not even ask if we can afford to pay for it? In retrospect, doctors should always qualify the financial capacity of the patient to pay for medical bills and that procedures should be conservative and given in accordance to patients' economic status. In other words, before an expensive procedure is to be given to a patient, a low cost alternative must first be considered unless extremely necessary.

If it may help to understand, doctors get as much as 15% to 30% percent (commission) for every laboratory referrals they make to private laboratories. The more referrals they make, the more income they generate - that is how the 'game' is played. Sad but true, there are no prevailing health care standards placed by our Government to better monitor and manage medical practice, much like an ISO for the manufacturing industry, and so doctors are left to do basically anything they want without being accountable for anything.

 

3. Give what is due to the Government.

Doctors make poor businessmen. A dishonest businessmen at that. In fact, they don't consider their practice a business at all; probably another excuse not to give official receipts and being chronically tardy. Doctors don't declare how much patients and money they earn for medical consultations. Doctors don't declare their commissions or referral fees they get from private laboratories and hospitals. Doctors don't declare cash gifts and bonuses. And, doctor's refuse to deduct taxes from services rendered to insurance holders. Well, if there is anything these doctors want to deduct from, it probably is their obligation of service and charity to their countrymen.

 

4. Stop asking favors.

We are in the business of health care and, part from being that, we hire doctors to manage our clinics. If there is truth to what our medical director once said that: "doctors need medical reps for conference sponsorships". Is it really a need or just merely a want? I pity the medical reps these days for they are reduced by these doctors to become their personal sponsors for conferences and even their dinner parties. This is one major reason why our medicines are among the most expensive in Asia because of the representation costs incurred by drug companies to these doctors. Yes, your doctor is the reason why they are expensive.

 

5. Work with the system.

Many doctors always seems to feel that they are always a cut above the rest. This probably stemmed from long and expensive education that they feel they should be given special treatment. Thus, being socially placed above the pedestal, they feel that they can work their best if there are less rules to follow. Rules that particularly govern their professional practice.

I can vividly remember when we first installed our first medical director to our chain of medical clinics and discussed on house rules and policies, they (the doctors) started feeling very uncomfortable.

 

The practice of medicine has changed dramatically over the years most specially with the advent of modern medical technology. We were able to probe deeper and understand primary causes of diseases and how we can protect ourselves from them. But, despite all the advancements, some basic yet very important things hasn't changed and that is how our modern shamans (doctors) practice their profession for the sake of science?

Stumble Upon Toolbar

Apr 18, 2009

Creative ideas to force yourself into saving 'automatically'.

Relaxed wLaptop_LoRes

I must admit, I am not really big on saving money much less on investing. However, we all need to save and make money one way or the other; if we atleast care about securing our future or our children's future.

The only way I know then on saving money is the same way how most people still do now - apportion an income and place it in a bank. Very crude and ineffective. No wonder saving money takes so much discipline and effort to make it work.

But before we jump in, allow me to say that there are two key elements that must always be considered when saving money. Elements needed to make saving money to work for you, every time. First is doing it 'automatically' and second, protecting it from yourself .

1) Saving 'Automatically'. This means having someone apportion your money for savings on your behalf with no conscious effort. A common example may be automatic deduction by your payroll officer or automatic fund transfers by your bank.

2) Protect from yourself. These may be processes or programs that limits you from touching your nest eggs from unnecessary withdrawals for a  specific period of time.

 

So what are other ways to save and how do we start it? Here it is:

1. Increase your monthly HDMF (Home Development Mutual Fund) contributions.

I am pretty sure that right now, you are paying only the minimum required by the government for your HDMF or PAG-IBIG. And, what still many of you do not know is that, PAG-IBIG also functions like a bank (a provident saving bank).

Increasing your PAG-IBIG contributions doubles or triples your money since this will be matched equally by your employer. So, say for example, your monthly contribution of 50 bucks is matched equally by your employer with another 50 bucks. That's easy money! Also, since it is a savings deducted together with your other obligations like your SSS; it is non-tax deductible and earns dividends overtime.

This means the more you contribute the more you earn overtime and without you even knowing it.

 

2. Get a savings-linked annuities.

Annuities are premium payments made on regular intervals like monthly, quarterly or annually. There are some non-traditional investment vehicles that are now linked to savings. A very good example is a whole life insurance where you pay annuities until the age when you plan to retire and a portion of these premium payments goes to your savings. This way, one is compelled to pay and save at the same time to get covered by an insurance.

I got mine at PruLife UK with a no-frill life insurance plan. Scout for a plan that fits your needs and make sure its linked to savings. To do this 'automatically', ask your payroll officer to do an automatic salary deduction and directly deposit the premium payments to the insurance company's bank account.

 

3. Save windfalls and extra incomes to savings-linked annuities or other investments.

Yes we do have windfalls once in a while and these may be in a form of bonuses or successful business deals. Windfalls or extra incomes provide for us an opportunity to advance our payments on mortgages, savings-linked annuities, or to buy more investments. The whole idea of advancing payment on savings-linked annuities other than increasing your savings is to protect you from difficult times such as unemployment.

But do not advance your savings-linked annuities too much as you might be putting all your nest eggs in one basket. An 18 to 24 advance payment will do the job and give you enough protection during hard times.

 

4. Simplify investment. Get a Managed Fund.

I've written in my previous blog article that I am completely opposed to putting my savings in a bank since it only earns very little interest plus other deductions. So it's really not a wise move if you do and it's only the banks that earns from your hard earned money.

So where do you put your money? Put it in a managed fund. I prefer managed fund because its simple, balanced yet yields higher returns, and less time consuming. This way, my money is diversified across different investments thus making it more secure in the long run.

 

5. Pretend that you didn't get a raise.

If you do get a raise, I highly advise you NOT to tell your wife or else... you know I mean. Since you and your family has adjusted to the lifestyle prior to your salary raise, keep your mouth shut and save the extra to any investment vehicles that you may have. Again, you may pay in advance your annuities or make another investments.

You can the again negotiate with your payroll officer to direct deposit the raise to annuities of your choice.

 

6. Buy Certificate of Deposits (CDs).

A certificate of deposit is a promissory note issued by a bank. It is a time deposit that restricts holders from withdrawing funds on demand. Although it is still possible to withdraw the money, this action will often incur a penalty.

CDs only offers a small annual rate of return, usually around 5%-6% per year but the good part is it prevents you from touching your money unnecessarily. It also provides another good option to place your windfalls or extra income since it only requires a minimum of five thousand (Php 5,000.00) pesos per certificate.

 

As you can see, there are ways to force yourself to save and there are still some more out there. So far, I only included those that works for me and still slowly increases my savings contribution every so often.

--End--

Stumble Upon Toolbar

Apr 16, 2009

That Crazy Horse

wild-horse-silhouette-in-a-blue-moonlight

That crazy horse! I think about it a lot these days.
Missing the sulky and misguided adventures, that
brought me in countless pits of dangers and mindful follies.
She was a foolish ride no doubt, but fun nonetheless.

Since that dusky hour of our depart,
immediately I felt the weight around my waist.
Dragged and lost into lands unfamiliar;
land of virtual peace and love. So they say.

That crazy horse may be truly crazy.
yet brings the warm glow of youth and,
the liberating but wondrous joy of unpretentious mind.
With this I say, I want to break lose and find my crazy horse.

Stumble Upon Toolbar