On 24 Mar 2013, at 5:03am, Igor Korot <ikoro...@gmail.com> wrote:

> When application starts I need to retrieve first all available players
> and then all players that are drafted.
> 
> Probably the easiest way would be to query playersinleague for all
> players and then query draftedplayers for all drafted players.

That way should work.  And your schema looks good too apart from SQLite having 
no 'double' type.  I recommend you store prices as integers instead.

> But is it efficient? Is it fastest?

Don't worry about either 'efficient' or 'fastest'.  Just worry about 'fast 
enough'.  Generally speaking the best way to design your program is whatever 
most resembles how you thought about solving the problem.  If the program works 
the way you think, it'll be easier to program and easier to debug.

If you write it, and it's annoyingly slow to use, then yes, go into heavy 
hacking mode and program for 10 hours to save 2 seconds runtime.  But until 
then it's wasted effort and hard to document.  In real life, most programs 
spend most of their time waiting for humans to do something.  You can speed 
something up by .84 seconds and nobody will ever notice.

> I will probably need an index created on draftedplayers on the leagueid, 
> right?

Right.  When making indexes do not think about "What columns would be good to 
index."  Instead think about "What kind of index would best suit that query ?". 
 So perhaps wait until you know more about the SELECT you'll be doing, because 
you might find that it has an ORDER BY clause you can put into the same index 
and speed it up even more.

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

Reply via email to