[PERFORM] Re: Fwd: Slow query from ~7M rows, joined to two tables of ~100 rows each

2017-06-26 Thread Karl Czajkowski
On Jun 26, Chris Wilson modulated: > I created the index starting with date and it did make a big > difference: down to 10.3 seconds using a bitmap index scan and bitmap > heap scan (and then two hash joins as before). > By the way, what kind of machine are you using? CPU, RAM, backing storage?

[PERFORM] Re: Fwd: Slow query from ~7M rows, joined to two tables of ~100 rows each

2017-06-26 Thread Karl Czajkowski
On Jun 26, Chris Wilson modulated: > ... > In your case, the equivalent hack would be to compile the small > dimension tables into big CASE statements I suppose... > > > Nice idea! I tried this but unfortunately it made the query 16 seconds > slower (up to 22 seconds) instead of faster.

[PERFORM] Re: Fwd: Slow query from ~7M rows, joined to two tables of ~100 rows each

2017-06-23 Thread Karl Czajkowski
On Jun 23, Chris Wilson modulated: > ... > create table metric_pos (id serial primary key, pos integer); > create index idx_metric_pos_id_pos on metric_pos (id, pos); > ... > create table asset_pos (id serial primary key, pos integer); > ... Did you only omit a CREATE INDEX statement o

Re: [PERFORM] Client Server performance & UDS

2017-05-30 Thread Karl Czajkowski
On May 30, Rick Otten modulated: > If your clients are keeping persistent connections open to the > database, and the latency you are experiencing is within the > transaction itself, you might look at disk I/O for your WAL (write > ahead logs) and take a closer look at WAL and checkpoint tuning. >

Re: [PERFORM] optimizing immutable vs. stable function calls?

2017-01-18 Thread Karl Czajkowski
On Jan 18, Tom Lane modulated: > Karl Czajkowski writes: > > Is there a correctness hazard with pretending our function is > > IMMUTABLE, even though we will change the underlying config parameter > > in the same connection? > > You could probably get away with

Re: [PERFORM] optimizing immutable vs. stable function calls?

2017-01-18 Thread Karl Czajkowski
On Jan 18, Tom Lane modulated: > "The same as IMMUTABLE" would be to reduce the function to a constant at > plan time, which would be the wrong thing. It would be valid to execute > it only once at query start, but there's no built-in mechanism for that. > That's what I was afraid of... right, w

[PERFORM] optimizing immutable vs. stable function calls?

2017-01-18 Thread Karl Czajkowski
I originally was thinking I had a performance problem related to row-level security but in reducing it to a simple test case I realized it applies more generally. The query planner does not seem to recognize that it can eliminate redundant calls to a STABLE function. It will optimize the same call