
using a cast on the literal number: where sa.id = 44681::bigint AND sa.ticket_id = st.id AND st.user_id = su.id yields a far better result: Sort (cost=16.34..16.34 rows=3 width=2928) Sort Key: sa.id -> Hash Join (cost=1.19..16.31 rows=3 width=2928) Hash Cond: ("outer".user_id = "inner".id) -> Nested Loop (cost=0.00..15.08 rows=3 width=2917) -> Index Scan using article_pkey on article sa (cost=0.00..3.04 rows=2 width=1624) Index Cond: (id = 44681::bigint) -> Index Scan using ticket_pkey on ticket st (cost=0.00..6.01 rows=1 width=1301) Index Cond: ("outer".ticket_id = st.id) -> Hash (cost=1.15..1.15 rows=15 width=15) -> Seq Scan on system_user su (cost=0.00..1.15 rows=15 width=15) Dunno why a seq scan is being done on system_user (st.user_id and su.id are both integer). -------------------------------------------------------- This message was sent using MetroWEB's AirMail service. http://www.metroweb.co.za/ - full access for only R73. Free Web Accelerator, WebMail, Calendar, Anti-Virus, Anti-Spam, 10 emails, 100MB personal webspace, and more! Phone Now! 086 11 11 440