Re: [PERFORM] Interesting case of IMMUTABLE significantly hurting performance

2013-08-14 Thread Tom Lane
Craig Ringer writes: > It's interesting that this variant doesn't seem to be slow: > create or replace function to_datestamp_immutable( > time_int double precision > ) returns date as $$ > select date_trunc('day', timestamp 'epoch' + $1 * interval '1 > second')::date; > $$ language sql immu

Re: [PERFORM] queries with DISTINCT / GROUP BY giving different plans

2013-08-14 Thread Tom Lane
"Tomas Vondra" writes: > I've run into a strange plan difference on 9.1.9 - the first query does > "DISTINCT" by doing a GROUP BY on the columns (both INT). ... > Now, this takes ~45 seconds to execute, but after rewriting the query to > use the regular DISTINCT it suddenly switches to HashAggrega

[PERFORM] queries with DISTINCT / GROUP BY giving different plans

2013-08-14 Thread Tomas Vondra
Hi all, I've run into a strange plan difference on 9.1.9 - the first query does "DISTINCT" by doing a GROUP BY on the columns (both INT). SELECT "f_account"."name_id" AS "a_1550", "f_message"."text_id" AS "a_1562" FROM "f_accountmessagefact" INNER JOIN "f_message" ON ( "f_accountmessagefac

Re: [PERFORM] Index on a range array

2013-08-14 Thread Daniel Cristian Cruz
I guess this is not a performance question... What kind of question would it be? Admin, General or SQL? 2013/8/13 Daniel Cristian Cruz > Hello, > > I'm trying to simplify a schema, where I had many ranges floating around. > My idea is to put them all in an array field and query like this: > > S