kj PS: FWIW, the query plan for the query with LIMIT 6000 is this:
What is the explain analyze?
QUERY PLAN ------------------------------------------------------------------------------------- Limit (cost=19676.75..21327.99 rows=6000 width=84) -> Hash Join (cost=19676.75..1062244.81 rows=3788315 width=84) Hash Cond: (upper(("outer".id)::text) = upper(("inner".id)::text)) -> Seq Scan on huge_table h (cost=0.00..51292.43 rows=2525543 width=46) -> Hash (cost=19676.00..19676.00 rows=300 width=38) -> Seq Scan on tiny_table t (cost=0.00..19676.00 rows=300 width=38) ------------=_1148485808-20617-3-- ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
-- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/