Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. No, not terrible... you just have to have an idea of how many CONCAT operators will be formed, that's all.
  2. So why not have two "middle tables", as you call them? Clearly they relate two completely separate things.
  3. Two dependent subqueries? Ouch...
  4. Yes, but php takes time to calculate the date too... And if you do the math on the value, not the column, the index can still be used.
  5. You could cheat by adding the covering index with the order-by'ed columns first... I think I've seen this work before, since the index itself is sorted... not sure how mysql figures this out, but I think it might work
  6. I wonder if mysql will still use the index if you leave out the DATE() function and just let MySQL deal with the casting... as written, it definitely won't... maybe I'll go check.
  7. It's not a "feature"... and it's mandatory because MySQL allows reserved characters and keywords everywhere. Just don't use it.
  8. Why not country_id?
  9. When I need to use it, I usually use: SET group_concat_max_len := @@max_allowed_packet Just realize that this can be very slow if you don't know what to expect.
  10. You need to join the table to itself.
  11. If you're going "up" (adding characters), then it's fine.
  12. What's confusing?
  13. fenway

    MySQL dates

    That would be '%d/%m/%Y'.
  14. Unless you have a covering index.
  15. Like, say, description.
  16. You can INSERT... WHERE anything. What are you trying to do?
  17. fenway

    Adding indexes

    Well, non-unique indexes are usually faster... for dropping, i'm not sure, though 5.1 does have some on-line operations. For adding, there is an implicit sort done from a temporary table, so look into increasing myisam_sort_buffer_size (assuming myisam tables).
  18. LEFT JOIN "nulls out" any columns in non-matching rows, so you were grouping by NULL.
  19. Strictly speaking, you can use ALTER TABLE to order rows, but that's usually meant for very expensive operations or on read-only tables.
  20. I'm pretty sure DISTINCT happens before ORDER BY..... so why not SELECT DISTINCT user_id FROM forum_members WHERE number_of_posts>0 ORDER by RAND() LIMIT 1
  21. Nor should it. Just always round up, then MOD 60, then FROM_UNIXTIME().
  22. No, you're right... check out 3rd part solutions, like Lucene or Sphinx.
  23. Could we keep the discussions to the forums, please?
  24. fenway

    SQL help

    It's possible you've created a dependent subquery... can we see the EXPLAIN?
×
×
  • 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.