On Fri, Sep 12, 2008 at 4:01 PM, Fernando Hevia <fhevia@ip-tel.com.ar> wrote:
>
>
>> -----Mensaje original-----
>> De: pgsql-sql-owner@postgresql.org
>> [mailto:pgsql-sql-owner@postgresql.org] En nombre de Scott Marlowe
>>
>> On Fri, Sep 12, 2008 at 12:50 PM, Hengky Lie
>> <hengkyliwandouw@gmail.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.