Subject Re: [Firebird-general] Randomly returning records
Author Martijn Tonies
Ed,

> I need to be able to return a random selection of records from a
> table. Each record needs be weighted in how often it gets returned
> compared to the other records. (What is happening is that I need to
> randomly return customer quotes to be displayed on a web site).
>
> Every method I've thought of seems pretty slow--any fast way of doing
> this? I can speed it up by having the sum of the weighted values in a
> different table (updated by triggers) but then selecting the records
> will require a bit of work--first selecting the IDs and weighting and
> then randomly selecting quotes.
>
> Any thoughts on a fast method for doing this?

How many records are we talking about?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com