Re: [GENERAL] Problems with non use of indexes

2012-03-03 Thread Scott Marlowe
On Fri, Mar 2, 2012 at 5:12 AM, Tyler Durden wrote: > Hi, > I can't figure out why query planner doesn't use the proper index, anyone > can help me? > > This query properly uses indexes: > > mydb=# EXPLAIN SELECT U0."object_id" FROM "activity_follow" U0 WHERE > (U0."content_type_id" = 3 AND U0."us

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tyler Durden
http://explain.depesz.com/s/f92O *EXPLAIN ANALYSE VERBOSE SELECT "activity_action"."id", "activity_action"."actor_id", "activity_action"."verb", "activity_action"."action_content_type_id", "activity_action"."action_object_id", "activity_action"."target_content_type_id", "activity_action"."target_o

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tomas Vondra
On 2 Březen 2012, 14:34, Tyler Durden wrote: > On Fri, Mar 2, 2012 at 12:55 PM, Tomas Vondra wrote: > >> On 2 Březen 2012, 13:45, Tyler Durden wrote: >> >> >> > Yes, but if I remove *U0."user_id" = 1 *will use the index: >> >> Which PostgreSQL version is that? Post EXPLAIN ANALYZE output for all >

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tyler Durden
On Fri, Mar 2, 2012 at 12:55 PM, Tomas Vondra wrote: > On 2 Březen 2012, 13:45, Tyler Durden wrote: > >> > > Yes, but if I remove *U0."user_id" = 1 *will use the index: > > Which PostgreSQL version is that? Post EXPLAIN ANALYZE output for all > three queries, not just EXPLAIN. And use explain.dep

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tomas Vondra
On 2 Březen 2012, 13:45, Tyler Durden wrote: >> > Yes, but if I remove *U0."user_id" = 1 *will use the index: Which PostgreSQL version is that? Post EXPLAIN ANALYZE output for all three queries, not just EXPLAIN. And use explain.depesz.com if possible, it's much more readable. kind regards Tomas

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tyler Durden
Hi, On Fri, Mar 2, 2012 at 12:23 PM, Tomas Vondra wrote: > Hi, > > On 2 Březen 2012, 13:12, Tyler Durden wrote: > > Hi, > > I can't figure out why query planner doesn't use the proper index, anyone > > can help me? > > > > This query properly uses indexes: > > > > mydb=# EXPLAIN SELECT U0."objec

Re: [GENERAL] Problems with non use of indexes

2012-03-02 Thread Tomas Vondra
Hi, On 2 Březen 2012, 13:12, Tyler Durden wrote: > Hi, > I can't figure out why query planner doesn't use the proper index, anyone > can help me? > > This query properly uses indexes: > > mydb=# EXPLAIN SELECT U0."object_id" FROM "activity_follow" U0 WHERE > (U0."content_type_id" = 3 AND U0."user_