Jump to content

jaymc

Members
  • Posts

    1,521
  • Joined

  • Last visited

    Never

Everything posted by jaymc

  1. So the speed Im having is purely down to table size?
  2. Yeh http://www.phpfreaks.com/forums/index.php?action=dlattach;topic=180554.0;attach=3744;image
  3. I changed LEFT to INNER and it didnt really make any difference in terms of query time, if thats what you meant? The EXPLAIN is attatched [attachment deleted by admin]
  4. The left join appears to be adding 0.3 seconds onto the total query time.. yet the cache table is only 50,000 rows and the username field does have an index on it
  5. Ok, the table is 6.7million rows and the query is pretty basic SELECT viewedpro.viewer, viewedpro.time, viewedpro.views, cache.propic as image FROM viewedpro LEFT JOIN cache ON viewedpro.viewer = cache.username WHERE viewedpro.username = 'JMC' GROUP BY viewedpro.viewer ORDER BY viewedpro.time DESC LIMIT 0,5 The execution time is completely dependant on the sheer size of the table rather than the query 0.8 seconds is quick for what its doing, but webpages should never really have a noticeable lag therefor I want to try and do something about it
  6. What is the best way to deal with heavily acessed large tables When I say large, lets just say you had a table with 5 million rows of data, all of which contain pretty well optimized data With an index yeh sure it only takes 0.8 second to complete a standard query, but this added with other queries combine to make a page take 3+ seconds to load What can one do when faced with a huge table which has relivent data and no redundant to clean out Bit stuck, any ideas/articles which go through combating this problem
  7. Change if (edit = "no") { to if (edit == "no") { == when comparing
  8. Problem What if its like this <div id="chat"> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> </div> Which will result in something like this <div id="chat"> lass="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> <div class="message">words words words words words words</div> </div> Hence, chopping bits of code off rendering anything there after problematic Think again He he
  9. I cant really erase all content as that will look like there has been an error or something is there a way to erase everything apart from the last 10 lines or something? Thus clearing the redundant clutter above that has been read?
  10. I have an ajax chatroom that works with a request to the database to pull in new messages, then append it to the bottom of the contents of a div This works but as you can imagin after 10 minutes of being in the chat the chat messages build up and eventually start to make it go a bit slow and in most cases crash How can I overcome this, at the moment new messages are added pretty much like this Document.getElementById(‘messages’).innerHTML = Document.getElementById(‘messages’).innerHTML + new_messages Hope someone can help
  11. Cheers
  12. Table view User - Friend Dan - Amy Stacey - Amy I have a friends table, When stacey goes on Dans profile, I want to check the friends table and see if they have any of the same friends, in the example above, they are both friends with Amy I need to pull out Amy and display her as a 'friend in common' How can i best do this, needs to be efficient as the table is very large and heavily accessed Cheers
  13. I dont get how that would resolve this problem or better coding practice? Can you explain/elaborate a bit?
  14. Any ideas?
  15. Ok, I have already asked this question about a month ago but didnt really get an answer, I dont think i explained well enough so here goes I have a whosonline page which displays members online. Lets says there are 500 members online and I display 10 per page. So, the first page displays 10 members currently online, I click next page and I get the next 10 and so on Now, I am on page 3, I go away for 5 minutes and come back to the computer. By then 100 people have went offline therefor the order I was displaying by has rejuggled. here is an example At 5.30PM 1 2 3 4 5 6 7 8 9 10 At 5:35pm 3 members 3,7,9 have went off line, meaning this 1 2 4 5 6 8 10 Which then becomes this to meet the requirments of LIMIT 0,10 1 // #1 2 // #2 4 // #3 5 // #4 6 // #5 8 // #6 10 // #7 11 // #8 12 // #9 13 // #10 My problem is, if I click next/back I sometimes get a few people on that page that where on the other page beucase people have dropped offline thus they take there place to fill the gaps I cant think of how I can overcome this? It seems quite simple but in practice.. a real pain!! I hope I have explained the problem well enough, any ideas to prevent this. What is the the standard way to display member online times which allow consistancy
  16. Ok, I am switching to making most of my things with functions nested inside classes Here is my question, which has now turned into a little debate The standard way is to build your class with functions, then if you need to use a function inside the class, include the class file Well, lets say the class file is 3000 lines (accumulation of 30 functions) Well, what if you only need to use 2 of the functions in there, your including 3000 lines of code when you only need 200 lines of it.. I think this would be bad in terms if Disk access time.. so I think it may be better to put each function in a file.. that way if you only need to use 1 fiunction you includfe the little function file, not the entire class What is the best way to do this, I am focusing on optimal, not easy for a programmer.. Thanks!
  17. <html> <head> <script> var go = "no" </script> </head> <body> <div id="lol" style="height:100px;overflow:scroll;" OnScroll="if(go == 'no'){alert('hi');go='yes'}else {}"> hey <BR> hey <BR> hey <BR> hey </div> There you go mate
  18. addslashes($_POST['name']); Or you can us ini_set to make it automatically add the quotes for all POST and GETS etc, if it isnt already set via the php conf on the server
  19. put them in an array called $whatever then do foreach ($whatever as $whatever) { mysql_query($whatever); }
  20. Does anyone make use of output_compression? Good points.. Bad points.. Is it pretty safe to say its better to have it than not in 95% of situations, rather than it only being suited to certain setups Advice would be great Cheers
  21. jaymc

    [SOLVED] Cron Job

    CHeers
  22. Thats the one mate, declaring it globally sorted the issue Cheers!
  23. jaymc

    [SOLVED] Cron Job

    Here is my cron conf GNU nano 1.2.4 File: crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO="" HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly
  24. jaymc

    [SOLVED] Cron Job

    Logs Jan 22 06:12:01 hostname crond[17863]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:13:01 hostname crond[17891]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:14:01 hostname crond[17916]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:15:01 hostname crond[17964]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Jan 22 06:15:01 hostname crond[17968]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:16:04 hostname crond[18003]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:16:04 hostname crond[18004]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/index.php) Jan 22 06:17:02 hostname crond[18041]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:17:02 hostname crond[18042]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:18:04 hostname crond[18074]: (root) CMD (php -f /home/sitename/includes/cache/dynamic/homepage.php) Jan 22 06:18:04 hostname crond[18075]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:18:04 hostname crond[18076]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:19:01 hostname crond[18114]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:19:01 hostname crond[18115]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:20:01 hostname crond[18146]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Jan 22 06:20:01 hostname crond[18149]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:21:03 hostname crond[18181]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:22:01 hostname crond[18207]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:23:04 hostname crond[18237]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:24:02 hostname crond[18269]: (root) CMD (cd /home/backups && ./backup.sh) backup.sh should be run once via this command in crontab * 6 * * * cd /home/backups && ./backup.sh Any idea what this is also? its not in crontab (crontab -e) Jan 22 06:20:01 hostname crond[18146]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Hope someone can help..
  25. jaymc

    [SOLVED] Cron Job

    Ok, I was right about cron running multiple times I have just come on today to find my server almost dead after it had run and was still running my backup.sh script This involves large copies and gzips aswell as DB locks I seen 3 instances of it in process list, aswell as 120 wgets which run every minute and only takes 1 second Hope some one knows what could cause cron to do this?
×
×
  • 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.