Yes, I've compiled a small list ordered by table, and have begun to work on some of these. Here are some of the more commons ones that I saw.
>>>>>>>>>>>>members
15 secs
select * from members where music = '1' ORDER BY RAND() LIMIT 1;
15 secs
select member_id from members where display_name like 'codyyy';
7 secs
select *from members a where 1=1 order by a.member_id desc;
6 secs
select * from members where featured='1' and music != '1' and gender like 'Male' ORDER BY RAND() LIMIT 1;
messages
7 secs
SELECT /*!40001 SQL_NO_CACHE */ * FROM `messages`;
8 secs
select * from messages where mess_to = 21547 and deleted <> 1;
messages_sent
87 secs
SELECT /*!40001 SQL_NO_CACHE */ * FROM `messages_sent`;
18 - 81 secs
update messages_sent set deleted = 1 where mess_by = 11888 and deleted <> 1; ///// no longer update, instead delete, just delete them and not where deleted <> 1
6 secs
select * from messages_sent where mess_by = 14293 and deleted <> 1;
messages_bodies
83 secs
SELECT /*!40001 SQL_NO_CACHE */ * FROM `message_bodies`;
member_friends
9 - 56 secs
select * from member_friends a, journal b where b.journal_of = a.friend_id and a.member_id = 22549 order by journal_id desc limit 0,8;
9 secs
SELECT friend_id FROM member_friends WHERE member_id = '22549' AND friend_id = '22549' LIMIT 1;
9 secs
select count(*) as re from member_friends where member_id = 27893 and approve = 1 and friend_id != 27893;
7 secs
SELECT /*!40001 SQL_NO_CACHE */ * FROM `member_friends`;
6 secs
select max(top_8_id) as mid from member_friends where member_id = '145';
invites
9 secs
select * from invites where member_id=39772 and member_email like 'filteredforpublicdisplay';
blogs
7 secs
select count(*) as a from blogs where member_id = 43776; ///////Apparently blogs didn't have member_id index - created
profile interests
14 secs
SELECT /*!40001 SQL_NO_CACHE */ * FROM `profile_interests`;
testimonials
12 secs
select count(*) as a from testimonials where member_id = 145 and approved = '1';
If something says select blah from blah where X and Y, then you should have both X and Y indexed? The reason I ask is if it says:
select * from members where featured='1' and music != '1' and gender like 'Male' ORDER BY RAND() LIMIT 1;
then should I index featured, music, and gender? I know that there's no reason in this situation to use gender LIKE when we can use gender = and I understand that I need to take out RAND(). I'm a little slow at this and don't like to break things if I can avoid to, so I'll have to wait until Sunday to do this.
Already I've gone through and removed some code that used to register you on the old auction script that I don't use anymore, and when you'd like it would log you into it also. Stuff like that is unnecessary and I'm sure the more unnecessary things the more likely you are to have problems.
Also I saw some queries that look strange to me, and I can't find them anywhere in the files on my server, so perhaps it's a mysql thing. I just can't research anymore tonight i'm exhausted and can barely type. 🙂 This one took 87 seconds
SELECT /*!40001 SQL_NO_CACHE */ * FROM `messages_sent`;
Thanks again, goodnight. Tomorrow I'll be trying to go through as many lines of code as possible to fix some of those things. Unfortunately when I did some initial code searches I see tons of these types of queries, or things like order by rand, etc.