<br><font size=2 face="sans-serif">On 04/17/2002 01:44:46 PM Michael Loftis wrote:<br>
> In many of the cases where it is a primary key it is also there to<br>
> ensure fast lookups when referenced as a foreign key. Or for joins.<br>
</font>
<br><font size=2 face="sans-serif">Don't know if the optimizer takes this into consideration, but a query that uses a primary and/or unique key in the where-clause, should always choose to use the related indices (assuming the table size is above a certain threshold). Since a primary key/unique index always restricts the resultset to a single row.....</font>
<br>
<br><font size=2 face="sans-serif">Somebody else mentioned that after creating an index, he still had to run analyze in order to get the optimizer to choose to use the index. I thought that 'create index' also updated pg_stats?</font>
<br>
<br><font size=2 face="sans-serif">Maarten</font>
<br><font size=2 face="sans-serif"><br>
----<br>
<br>
Maarten Boekhold, maarten(dot)boekhold(at)reuters(dot)com<br>
<br>
Reuters Consulting<br>
Dubai Media City<br>
Building 1, 5th Floor<br>
PO Box 1426<br>
Dubai, United Arab Emirates<br>
tel:+971(0)4 3918300 ext 249<br>
fax:+971(0)4 3918333<br>
mob:+971(0)505526539</font>
<CODE><FONT SIZE=3><BR>
<BR>
------------------------------------------------------------- ---<BR>
Visit our Internet site at http://www.reuters.com<BR>
<BR>
Any views expressed in this message are those of the individual<BR>
sender, except where the sender specifically states them to be<BR>
the views of Reuters Ltd.<BR>
</FONT></CODE>