Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 928F01337B93 for ; Tue, 8 Mar 2011 07:17:51 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 45418-02 for ; Tue, 8 Mar 2011 11:17:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mail.postgresql.org (Postfix) with ESMTP id D9B661337B3E for ; Tue, 8 Mar 2011 07:17:43 -0400 (AST) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1Pwuv8-0001Jt-PE for pgsql-performance@postgresql.org; Tue, 08 Mar 2011 03:17:42 -0800 Date: Tue, 8 Mar 2011 03:17:42 -0800 (PST) From: sverhagen To: pgsql-performance@postgresql.org Message-ID: <1299583062773-3413801.post@n5.nabble.com> In-Reply-To: References: <1299024855300-3405914.post@n5.nabble.com> <4D6DBC63.7080109@squeakycode.net> <1299111156142-3407330.post@n5.nabble.com> <4D6F054A.2090208@squeakycode.net> <1299143960277-3407689.post@n5.nabble.com> <4D6FABF1.50206@squeakycode.net> Subject: Re: Performance trouble finding records through related records MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.422 tagged_above=-10 required=5 tests=BAYES_00=-1.9, SARE_BAYES_5x7=0.6, SARE_BAYES_6x7=0.6, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201103/86 X-Sequence-Number: 42765 Hi. Thanks for your response. Robert Haas wrote: > > Join Filter: ((events_events.transactionid)::text = > (customerdetails.transactionid)::text) > > Now why is there a cast to text there on both sides? Do those two > columns have exactly the same datatype? If not, you probably want to > fix that, as it can make a big difference. > Good question. I seem not able to get rid of that, even though these are same type: =# \d events_events Table "public.events_events" Column | Type | Modifiers ----------------------+--------------------------+---------- [snip] transactionid | character varying(36) | not null [snip] =# \d events_eventdetails Table "public.events_eventdetails" Column | Type | Modifiers ---------------+------------------------+---------- [snip] transactionid | character varying(36) | not null [snip] (These columns allowing null or not is just something I've been playing with to no avail too.) Robert Haas wrote: > > Also, how many rows are there in events_events and how many in > events_eventdetails? > select count(*) from events_events; --> 3910163 select count(*) from events_eventdetails; --> 30216033 select count(*) from events_eventdetails_customer_id; (single partition) --> 2976101 -- View this message in context: http://postgresql.1045698.n5.nabble.com/Performance-trouble-finding-records-through-related-records-tp3405914p3413801.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com.