Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group