| | |
Speed of member profiles
![]() |
I have fixed the bug that was causing the ridiculous slowdown when viewing member profiles. It turns out that a particular WHERE clause in one of the queries was slowing things down too much, and after catching the culpreit, I was able to perform the query in PHP instead.
The speed of finding unanswered threads has also been rectified, unfortunately at the cost of showing the results as threads instead of as posts.
Neither, actually. I had an SQL statement of the type:
For whatever reason, it was taking a ridiculously long amount of time, despite having a MySQL index on the table column. So what I went and did was remove the first WHERE clause and instead sanitized the $php_array array to never include the element 123 before the sql query even runs. (I needed $php_array to include element 123 elsewhere in the script except for this particular SQL query which is why I did it that way to begin with.)
sql Syntax (Toggle Plain Text)
SELECT * FROM table WHERE COLUMN <> 123 AND FIND_IN_SET(COLUMN, $php_array)
Last edited by cscgal; Feb 17th, 2007 at 1:37 pm.
Don't pick on me
MySQL had to examine COLUMN anyways. It's not my fault it did a brute force search on all of the rows twice just because I wanted to compare COLUMN against a variable and an array.
MySQL had to examine COLUMN anyways. It's not my fault it did a brute force search on all of the rows twice just because I wanted to compare COLUMN against a variable and an array. I'm thinking it would traverse all rows eliminating those where column is 123, and then go back on all of the others and check whether the value of column is in the array, so essentially that's going over nearly everything twice, no?
Well I did use a FIND_IN_SET() clause?
Well I did use a FIND_IN_SET() clause?
•
•
•
•
I'm thinking it would traverse all rows eliminating those where column is 123, and then go back on all of the others and check whether the value of column is in the array, so essentially that's going over nearly everything twice, no?
So if I were to use:
sql Syntax (Toggle Plain Text)
SELECT * FROM Emp WHERE (emp_name LIKE '%Dani%') AND (emp_id IN (1, 2, 3, 4, 5)) AND (sal > 10000) ;
•
•
•
•
Well I did use a FIND_IN_SET() clause?
Last edited by ~s.o.s~; Feb 17th, 2007 at 11:09 pm.
I don't accept change; I don't deserve to live.
FIND_IN_SET() appears to be similar to your IN() clause. However, you have to understand that this whole query is meant to determine which a member's favorite forums are and other members interested in the same forums. Therefore, we're searching 300,000+ rows first to see if one column isn't equal to a certain value (cuts out about 10%) and then seeing if the column value is in an array (searching the remaining 90%).
![]() |
Similar Threads
- Member profiles (Growing an Online Community)
- Are member profiles guest accessible? (Growing an Online Community)
Other Threads in the DaniWeb Community Feedback Forum
- Previous Thread: New Quick Reply
- Next Thread: RSS Feeds
| Thread Tools | Search this Thread |
+ abuse beginners bookmark bored box bug bugs calamity code codebox codesnippets codetags code_snippet comments cpuintensive daniweb design editcodesnippet end-of-the-world favouriteforums feedback ff3 flamewar glitch ie6 itsatag! kids layout login lulz negative newfeature poll post preview privatemessaging problem profanitytest profile quality quick rashakil-fol reply reputation reputation-power sandwich score search snippet socialgroups solvedthreads sub-forum suggestion tagcloud tagging tags theactualrulerofthetag-cloud:3 therulerofthetag-cloud:[ thread threadtagging today's-posts unansweredposts upgrade user voting whining






