From: Tom Lane <tgl@sss.pgh.pa.us>
To: meetesh.karia@alumni.duke.edu
Cc: John Arbash Meinel <john@arbash-meinel.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Planner incorrectly choosing seq scan over index scan
Date: Mon, 01 Aug 2005 20:15:26 -0400
Message-ID: <26292.1122941726@sss.pgh.pa.us> (raw)
In-Reply-To: <fc5b04ca05080116564d1b3323@mail.gmail.com>
References: <fc5b04ca05080115195d15c456@mail.gmail.com>
<42EEAD4B.4010905@arbash-meinel.com>
<fc5b04ca05080116564d1b3323@mail.gmail.com>
Meetesh Karia <meetesh.karia@gmail.com> writes:
> Sure. The lte_user table is just a collection of users. user_id is assigned=
> uniquely using a sequence. During some processing, we create a candidates=
> table (candidates617004 in our case). This table is usually a temp table.=
> sourceid is a user_id (in this case it is always 617004) and targetid is=20
> also a user_id (2860 distinct values out of 3467). The rest of the=20
> information is either only used in the select clause or not used at all=20
> during this processing.
If you know that sourceid has only a single value, it'd probably be
helpful to call out that value in the query, ie,
where ... AND c.sourceId = 617004 ...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, meetesh.karia@alumni.duke.edu, john@arbash-meinel.com
Subject: Re: Planner incorrectly choosing seq scan over index scan
In-Reply-To: <26292.1122941726@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox