Re: Pls Hlp: SQL Problem

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar>
Cc: "Hengky Lie" <hengkyliwandouw(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Pls Hlp: SQL Problem
Date: 2008-09-12 23:50:19
Message-ID: dcc563d10809121650m5da73695n247a04ef51e68d16@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Sep 12, 2008 at 4:01 PM, Fernando Hevia <fhevia(at)ip-tel(dot)com(dot)ar> wrote:
>
>
>> -----Mensaje original-----
>> De: pgsql-sql-owner(at)postgresql(dot)org
>> [mailto:pgsql-sql-owner(at)postgresql(dot)org] En nombre de Scott Marlowe
>>
>> On Fri, Sep 12, 2008 at 12:50 PM, Hengky Lie
>> <hengkyliwandouw(at)gmail(dot)com> wrote:
>> > Dear Richard,
>> >
>>
>> Put parens around the whole thing, like:
>>
>> (tbltransaksi.hargapokok * tbltransaksi.keluar)::numeric(2,0) AS modal
>>
>
> Consider that if you are NOT going to use the decimals you should really use
> integer or bigint datatypes. The numeric type compute much slower than
> integer datatypes.

Note that if you're just converting the output the cost is minimal
compared to if you're doing all your math in numeric. It's when you
force math to happen that numeric is slower, but numeric's gotten a
lot of tuning in the last few years and it's withing a few percentage
of integer for most measurements. Definitely not twice as slow or
anything like they once were.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message davidn 2008-09-14 10:10:09 selecting current UTC time
Previous Message Fernando Hevia 2008-09-12 22:01:56 Re: Pls Hlp: SQL Problem