Re: [PERFORM] poor execution plan because column dependence

2011-04-15 Thread Václav Ovsík
Dear Tom, On Thu, Apr 14, 2011 at 10:10:44AM -0400, Tom Lane wrote: > =?iso-8859-1?Q?V=E1clav_Ovs=EDk?= writes: > > I'm not certain about your sentence touching int4eq() and index. The > > execution plan as show in my previous mail contains information about > > using index tickets5: > > >

Re: [PERFORM] poor execution plan because column dependence

2011-04-14 Thread Tom Lane
=?iso-8859-1?Q?V=E1clav_Ovs=EDk?= writes: > I'm not certain about your sentence touching int4eq() and index. The > execution plan as show in my previous mail contains information about > using index tickets5: >-> Index Scan using tickets5 on tickets main > (cost=0.00..4.38 rows

Re: [PERFORM] poor execution plan because column dependence

2011-04-14 Thread Václav Ovsík
On Wed, Apr 13, 2011 at 12:24:06PM -0400, Tom Lane wrote: > > Interesting the original index tickets5 is still used for > > int4eq(main.effectiveid, main.id), no need to build a different. > > Well, no, it won't be. This hack is entirely dependent on the fact that > the optimizer mostly works wit

Re: [PERFORM] poor execution plan because column dependence

2011-04-13 Thread Tom Lane
=?iso-8859-1?Q?V=E1clav_Ovs=EDk?= writes: > On Tue, Apr 12, 2011 at 08:52:15PM -0400, Tom Lane wrote: >> ... If you can change it, try replacing main.EffectiveId = main.id >> with the underlying function, eg if they're integers use >> int4eq(main.EffectiveId, main.id). This will bypass the overop

Re: [PERFORM] poor execution plan because column dependence

2011-04-13 Thread Václav Ovsík
Dear Tom, On Tue, Apr 12, 2011 at 08:52:15PM -0400, Tom Lane wrote: >.. > Yeah, that main.EffectiveId = main.id clause is going to be > underestimated by a factor of about 200, which is most though not all of > your rowcount error for that table. Not sure whether you can do much > about it, if t

Re: [PERFORM] poor execution plan because column dependence

2011-04-13 Thread Václav Ovsík
Dear Bob, On Tue, Apr 12, 2011 at 05:14:29PM -0700, Bob Lunney wrote: > Zito, > > Using psql log in as the database owner and run "analyze verbose". Happiness > will ensue. Unfortunately not. I ran "analyze" with different values default_statistics_target till 1000 as first tries always with t

Re: [PERFORM] poor execution plan because column dependence

2011-04-12 Thread Tom Lane
=?iso-8859-1?Q?V=E1clav_Ovs=EDk?= writes: > I think the execution plan is poor. Better would be to filter table > attachments > at first and then join the rest. The reason is a bad estimate on number of > rows > returned from table tickets (85 estimated -> 25410 in the reality). > ... > The prob

Re: [PERFORM] poor execution plan because column dependence

2011-04-12 Thread Bob Lunney
> From: Václav Ovsík > Subject: [PERFORM] poor execution plan because column dependence > To: pgsql-performance@postgresql.org > Date: Tuesday, April 12, 2011, 7:23 PM > Hi, > I have done migration of the Request Tracker 3.8.9 > (http://requesttracker.wikia.com/wiki/HomePage

[PERFORM] poor execution plan because column dependence

2011-04-12 Thread Václav Ovsík
Hi, I have done migration of the Request Tracker 3.8.9 (http://requesttracker.wikia.com/wiki/HomePage) from Mysql to PostgreSQL in testing environment. The RT schema used can be viewed at https://github.com/bestpractical/rt/blob/3.8-trunk/etc/schema.Pg. I have added full text search on table Attach