Re: [PERFORM] Slow query in trigger function

2015-11-03 Thread Guido Niewerth
These are the queries I used to get the execution planer use the index scan instead of the sequential scan: IF NOT EXISTS (SELECT 1 FROM custom_data WHERE key = old.key) => sequential scan IF NOT EXISTS (SELECT 1 FROM custom_data WHERE key = old.key LIMIT 1) => sequential scan IF NOT EXISTS (SEL

Re: [PERFORM] GIN index always doing Re-check condition, postgres 9.1

2015-11-03 Thread Andrey Osenenko
Jeff Janes: That is such a beautiful little trick. I made a table with just ids, and a query for it reads almost 10 times less buffers (as reported by explain analyze buffers), and sure enough, after another reboot, query executes about 10 times faster. I'm not doing anything special with those r