From: Craig Ringer <ringerc@ringerc.id.au>
To: Anish Kejariwal <anishkej@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Calculating statistic via function rather than with query is slowing my query
Date: Thu, 18 Aug 2011 13:32:34 +0800
Message-ID: <4E4CA3F2.1080604@ringerc.id.au> (raw)
In-Reply-To: <CAOpcnr-vYZgT+TMmv58rHCSzeDX9eu_+FmR16pUAkL-DxkrM4w@mail.gmail.com>
References: <CAOpcnr9q2-q-n3TkuQFFgwc2UANFikZoFqhPwfmBJFu6b_MVrw@mail.gmail.com>
<CAFj8pRDVTgF6RQwOEs1wJLHWy-FVO-mFGFRkZF70rmrxY8GTCQ@mail.gmail.com>
<CAOpcnr-1=YGsp=OAV58cdEfNw4EEuuzEqo53+9C7kURZLmX4Ew@mail.gmail.com>
<4E4C575D.6080008@ringerc.id.au>
<CAOpcnr-vYZgT+TMmv58rHCSzeDX9eu_+FmR16pUAkL-DxkrM4w@mail.gmail.com>
On 18/08/2011 9:03 AM, Anish Kejariwal wrote:
> Thanks for the help Pavel and Craig. I really appreciate it. I'm
> going to try a couple of these different options (write a c function,
> use a sql function with case statements, and use plperl), so I can see
> which gives me the realtime performance that I need, and works best
> for clean code in my particular case.
Do you really mean "realtime"? Or just "fast"?
If you have strongly bounded latency requirements, any SQL-based,
disk-based system is probably not for you. Especially not one that
relies on a statics-based query planner, caching, and periodic
checkpoints. I'd be looking into in-memory databases designed for
realtime environments where latency is critical.
Hard realtime: If this system fails to respond within <x> milliseconds,
all the time, every time, then something will go "smash" or "boom"
expensively and unrecoverably.
Soft realtime: If this system responds late, the late response is
expensive or less useful. Frequent late responses are unacceptable but
the occasional one might be endurable.
Just needs to be fast: If it responds late, the user gets irritated
because they're sitting and waiting for a response. Regular long stalls
are unacceptable, but otherwise the user can put up with it. You're more
concerned with average latency than maximum latency.
--
Craig Ringer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: ringerc@ringerc.id.au, anishkej@gmail.com, pavel.stehule@gmail.com
Subject: Re: Calculating statistic via function rather than with query is slowing my query
In-Reply-To: <4E4CA3F2.1080604@ringerc.id.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox