sqlite> insert into playlists (title,type,items,db_timestamp,idx) values ('Recent Adds',0,100,0,0);
sqlite> select last_insert_rowid();
sqlite> insert into playlistitems select NULL,154,id from songs order by time_added desc limit 100;
wow, that DB code looks weird.
is idx an auto-increment field? it should be a unique key anyhow. in oracle you do that with a sequence. anywho….
insert into playlistitems select NULL,154,id from songs order by time_added desc limit 100;
looks weirdish too.
INSERT INTO playlistitems
(SELECT NULL, 154, id
ORDER BY time_added DESC limit 100);
that doesnt even look like proper SQL to me. you probably meant:
(SELECT id from SONGS ORDER by time_added DESC limit 100);
in that sub-select.
that deffo does a full table scan, since there are no indices.
I guess the last 100 indices of songs would suffice, since its a auto-increment field, or sequence of some-sort, right?