On Fri, 1 Mar 2013 20:08:55 -0500
Stephen Chrzanowski <pontia...@gmail.com> wrote:

> > I can't think of any reason a foreign key constraint would impact
> > the cost of joins in any query. The cost is entirely at update time
> > (when you have to enforce the constraint).
> >
> 
> Wouldn't you have to do a look up to procure the list of keys to see
> what is actually part of the result set, or would that be decided
> within the WHERE logic/filtering?

No, the DBMS doesn't "procure a list of keys".  .To execute a JOIN or
WHERE clause, it matches *data*.  It might use an index, but that's
just an optimization.  

When you say

        from A join B on a.a = b.a

the DBMS must find every row in B meeting the criteria.  The existence
or nonexistence of a FK defined on A referring to B is irrelevant.  

HTH.  

--jk
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to