Re: Overriding the optimizer

From: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
To: Jaime Casanova <systemguards(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Overriding the optimizer
Date: 2005-12-16 16:49:21
Message-ID: 43A2F011.9050809@modgraph-usa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jaime Casanova wrote:
>>The context is this - in a busy OLTP system, sometimes a query comes
>>through that, for whatever reason (foolishness on my part as a
>>developer, unexpected use by a user, imperfection of the optimizer,
>>etc.), takes a really long time to run, usually because it table-scans
>>one or more large tables. If several of these happen at once, it can
>>grind an important production system effectively to a halt. I'd like to
>>have a few users/operations get a "sorry, I couldn't find a good way to
>>do that" message, rather than all the users find that their system has
>>effectively stopped working.
> ...
> set statement_timeout in postgresql.conf

I found it's better to use "set statement_timeout" in the code, rather than setting it globally. Someone else pointed out to me that setting it in postgresql.conf makes it apply to ALL transactions, including VACUUM, ANALYZE and so forth. I put it in my code just around the queries that are "user generated" -- queries that are from users' input. I expect any SQL that I write to finish in a reasonable time ;-).

Craig

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mitch Skinner 2005-12-16 19:13:31 Re: Overriding the optimizer
Previous Message Tom Lane 2005-12-16 15:23:21 Re: ALTER TABLE SET TABLESPACE and pg_toast