Sam Carleton wrote: > I am new to SQLite and databases, so I am stil learning how to > optimize their use... > > I am working on a "shopping cart" type of feature, it is actually a > favorites feature for a system that displays images in multiple > galleries. There is a SQLite table that contains the user_id, > gallery_id, and image_id. When a index page is displayed, only a sub > set of the images in the gallery are displayed. So the question is > what will be faster: > > 1: Doing a SELECT for each image on the favorites table to see if it is > selected > 2: Doing one SELECT to get all the images for the current gallery and > store that into a PHP array and then simply look in the PHP for each > image? > > My thought is option 2. Is that correct?
The less database hits you have to do, the faster your code will be. Getting all the data into a PHP data structure should be the way to go. -- Scott Baker - Canby Telcom RHCE - System Administrator - 503.266.8253 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users