Pavlo wrote:
> What I have is one big table storing all mandatory properties of an entity 
> and several small tables, storing optional properties.
>
> So, when I need to select big number of elements using JOIN the probability 
> of optional properties is low.
> And so, for every row from big table there will be ~99% of join lookups in 
> small tables leading to NULLs.
>
> So I got an idea to store flags in big table telling me whether optional 
> property is present (flag).
> I want to lookup small tables only when flag is set but I can't see how to 
> tell SQLite to skip JOIN lookup for certain rows and return NULLs.

  SELECT * FROM Big LEFT JOIN Small ON Big.flag AND Big.ID = Small.BigID

However, for small tables, the IDs will be in the cache anyway.
It is unlikely that this will make any noticeable difference.


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

Reply via email to