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. -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance