Re: [PERFORM] Plan uses wrong index, preferring to scan pkey index instead

2014-11-18 Thread Yuri Kunde Schlesner
On Sun, Nov 16, 2014, at 03:18 PM, Tom Lane wrote: > I suspect that the reason the planner likes the backlog_pkey is that it's > almost perfectly correlated with table order, which greatly reduces the > number of table fetches that need to happen over the course of a > indexscan > compared to using

Re: [PERFORM] Plan uses wrong index, preferring to scan pkey index instead

2014-11-16 Thread Tom Lane
Yuri Kunde Schlesner writes: > Does anyone know if there's any tweaking I can do in Postgres so that it > uses the appropriate plan? I suspect that the reason the planner likes the backlog_pkey is that it's almost perfectly correlated with table order, which greatly reduces the number of table fe

Re: [PERFORM] Plan uses wrong index, preferring to scan pkey index instead

2014-11-15 Thread Yuri Kunde Schlesner
Looks like my client mangled (reflowed) the command outputs, so I requoted them in this message sent as plain text. In case it happens again I also posted them to a pastebin here: https://gist.github.com/yuriks/e86fb0c3cefb8d348c34 --yuriks On Sat, Nov 15, 2014, at 09:16 PM, Yuri Kunde Schlesner

[PERFORM] Plan uses wrong index, preferring to scan pkey index instead

2014-11-15 Thread Yuri Kunde Schlesner
Hi all, Excuse me if I made any mistakes, as this is my first time posting to a mailing list. I'm a user of Quassel, a IRC client that uses postgres a backing store for IRC logs and am running into heavy intermittent performance problems. I've tracked it down to a query that takes a very long ti