Ass Hat
Home
News
Events
Bands
Labels
Venues
Pics
MP3s
Radio Show
Reviews
Releases
Buy$tuff
Forum
  Classifieds
  News
  Localband
  Shows
  Show Pics
  Polls
  
  OT Threads
  Other News
  Movies
  VideoGames
  Videos
  TV
  Sports
  Gear
  /r/
  Food
  
  New Thread
  New Poll
Miscellaneous
Links
E-mail
Search
End Ass Hat
login

New site? Maybe some day.
Username:
SPAM Filter: re-type this (values are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, or F)
Message:


UBB enabled. HTML disabled Spam Filtering enabledIcons: (click image to insert) Show All - pop

b i u  add: url  image  video(?)
: post by the_reverend at 2005-12-01 10:13:14
yes, and god forbid.
it's cause there were holes in my database numbering scheme.

originally, I had the top set to the mysql random
ORDER BY rand()
but with 200K+ entries in the database, it could take up to 15 seconds.

so I was "smart" and got it down to .001 seconds.
by saying "database what is the max number in the database"
then I would randomly select a number between 0 and that max number.
since there are holes in my databases, I would select the index one higher than this randomly selected number.
problem: if there are holes... like there are before the catch22 picture, the angela rose picture, a god forbid picture and more, then there would be up to a 1300x chance that that picture would be selected.

soooo.. what I did was rethink the database in regards to caching. so I went with the SQL command of selecting the entire pictures database.
(this should always be cached anyhow). so what I do now is
select all pictures in the database
find the max picture index
randomly select a picture from 0 to the max index number
and then use the random number to index off the collection of all the pictures in the database.
this runs around .2 second
not bad, better than 15 seconds and better than the catch 22 picture showing up over and over.
[default homepage] [print][4:46:57am Apr 28,2024
load time 0.01178 secs/10 queries]
[search][refresh page]