Best way to prune my list of returned rows?

Every example and tutorial I can find shows how to create and paginate a
list of rows returned from a table. But I’m trying to write an
interface on top of an existing table with 4million rows. So I need to
jump right to the lesson on searching my data. That, I can’t find.

Can somebody tell me the techniques available for pruning down my list a
bit? I found a “search generator”, which seems like the best approach
for the long term, allowing me to search on whatever I want and doing
the grunt work of setting up the appropriate views. But in order to
even try that out I have to run the indexer on my table, and I have no
way of predicting how many hours that will take. I’m trying to get a
demo up and running show I can show the boss.

Second approach, I’m hoping, is to go to a field I know, like email
address (this is for user records) and break the list down into more
manageable groups by first couple of letters of email address.

Can somebody help me with that, or offer a different/better way? I’m
playing with stuff like this:

def list
@users = paginate User.find_by_sql “select * from users where email
like ‘A%’”
end

but it’s not really cutting it.

Thanks!

Hello Duane !

2005/12/29, Duane [email protected]:

def list
@users = paginate User.find_by_sql “select * from users where email
like ‘A%’”
end

Please see:

http://rubyurl.com/tGQ
http://blog.teksol.info/articles/2005/10/31/building-the-sql-where-clause-dynamically-in-rails

and

http://rubyurl.com/aka
http://blog.teksol.info/articles/2005/12/09/building-the-sql-where-clause-dynamically-revisited

Hope that helps !