Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. Yes, that would VERY slow! Why does it matter if it's "repeated"
  2. mysql_query() will return TRUE on success... don't know why you think otherwise.
  3. OMG, please stop. Echo the actual sql statment that you're sending to the server, and post the error message you get -- no attachements.
  4. Well, you can "force" the other index to be used, but I'm not sure it would be faster... try it and see (make sure the cache is off). EXPLAIN SELECT * FROM user_history FORCE INDEX( user_history_datetime ) WHERE user_id=72 ORDER BY user_history_datetime LIMIT 0,25
  5. The code looks fine...
  6. I'd prefer to "wrap" it in the delimeter too, but it's unlikely to be an issue for formatted data like IPs.
  7. Ugh... use DATE() functions for what they were meant for!
  8. So, solved?
  9. You're mixing ORs and ANDs without parens.
  10. Version 6, I think....
  11. You don't want to get rid of "using where" -- otherwise you'll have a full table scan. As for the filesort, it's not using the index on user_history_datetime because it has "decided" that it's faster to narrrow down the table using the user_id instead. How big is your table? It seems to find ~30K matching user_id rows. Have you run OPTIMIZE lately? What table type?
  12. If you had both "lists" in a table, the comparison would be trivial.
  13. Listen to the error... you didn't select a db.
  14. Yes, you can't use GROUP BY and retrieve non-aggregate columns.
  15. I don't understand.
  16. The adjacency list model (the one you are using) makes getting all parents or descendants a complex problem -- you'll have to self-JOIN as many times as you think the list is deep.
  17. Dynamic fields/tables in a bad idea.
  18. No... only inserts can be truly delayed, AFAIK.
  19. You'll need a join for each of the "AND" conditions.... there are many threads that cover this topic.
  20. You're missing a join condition.
  21. I don't understand your question.
  22. In the echo. Alternatively, $users = mysql_result($sql, 0, 0); Will work too.
  23. Yikes.
  24. Or by reading the stickies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.