I want to test performance of project.
So i want make 10000 record of table for testing.
I don't know how to ganerate record.
Who can help me? Thanks.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Greg Akins at Apr 5, 2013 at 3:13 pm
    Depends on what you're trying to test.

    If it's a single table and the values in the database don't matter, you can
    just add a [0..10000].each loop in seed.rb

    Or copy production data

    Or use a sql script to load your database

    Or one of these
    http://watirmelon.com/2012/06/15/three-ways-to-generate-test-data-for-your-ruby-automated-tests/
    On Fri, Apr 5, 2013 at 11:08 AM, haxuan lac wrote:

    I want to test performance of project.
    So i want make 10000 record of table for testing.
    I don't know how to ganerate record.
    Who can help me? Thanks.


    Greg Akins
    http://twitter.com/akinsgre

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Julian Leviston at Apr 5, 2013 at 11:37 pm

    On 06/04/2013, at 2:13 AM, Greg Akins wrote:

    Depends on what you're trying to test.

    If it's a single table and the values in the database don't matter, you can just add a [0..10000].each loop in seed.rb

    Or copy production data

    Or use a sql script to load your database

    Or one of these http://watirmelon.com/2012/06/15/three-ways-to-generate-test-data-for-your-ruby-automated-tests/

    On Fri, Apr 5, 2013 at 11:08 AM, haxuan lac wrote:
    I want to test performance of project.
    So i want make 10000 record of table for testing.
    I don't know how to ganerate record.
    Who can help me? Thanks.



    Greg Akins
    http://twitter.com/akinsgre


    --
    Props, Greg! I'm impressed with your response. I saw the question, and these kinds of questions really bother me because they lack specificity. I was thinking maybe we should have a noob web form app that could help them build their questions properly for submitting, by asking THEM lots of questions. :) Then we could just point them to it, and say hey, do this! :)

    But yeah, "more information please, as much as possible" is such a common thing to say.

    Julian

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jordon Bedwell at Apr 5, 2013 at 11:43 pm

    On Fri, Apr 5, 2013 at 6:37 PM, Julian Leviston wrote:

    Props, Greg! I'm impressed with your response. I saw the question, and
    these kinds of questions really bother me because they lack specificity. I
    was thinking maybe we should have a noob web form app that could help them
    build their questions properly for submitting, by asking THEM lots of
    questions. :) Then we could just point them to it, and say hey, do this! :)

    But yeah, "more information please, as much as possible" is such a common
    thing to say.

    Maybe we should also have a big ass sign on-top of it for people who make
    worthless comments, all it needs to say is "don't make worthless comments."
    And yes, I realize the irony.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Haxuan lac at Apr 5, 2013 at 3:34 pm
    Thanks Greg Akins
    I'm using MongoDB and in Mongodb has some table as:
    user,comment,photo,relationship
    And tables have ralationship(user relationship with photos..) ....
    Could you give me some advice for this problem?Thanks

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Gintautas Šimkus at Apr 5, 2013 at 3:56 pm
    You can add data via Rails models, like

    User.create({ <your attributes for user goes there })

    Just use rails code inside seed.rb to generate whatever you like and then
    run rake task which is something like `rake db:seed`


    2013/4/5 haxuan lac <lists@ruby-forum.com>
    Thanks Greg Akins
    I'm using MongoDB and in Mongodb has some table as:
    user,comment,photo,relationship
    And tables have ralationship(user relationship with photos..) ....
    Could you give me some advice for this problem?Thanks

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Pagarbiai,
    Gintautas

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Gintautas Šimkus at Apr 5, 2013 at 4:04 pm
    As far as cloning development DB into test DB, check out
    http://stackoverflow.com/questions/2645022/rails-populate-test-database-with-development-data




    2013/4/5 Gintautas Šimkus <dihitales@gmail.com>
    You can add data via Rails models, like

    User.create({ <your attributes for user goes there })

    Just use rails code inside seed.rb to generate whatever you like and then
    run rake task which is something like `rake db:seed`


    2013/4/5 haxuan lac <lists@ruby-forum.com>
    Thanks Greg Akins
    I'm using MongoDB and in Mongodb has some table as:
    user,comment,photo,relationship
    And tables have ralationship(user relationship with photos..) ....
    Could you give me some advice for this problem?Thanks

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Pagarbiai,
    Gintautas


    --
    Pagarbiai,
    Gintautas

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Haxuan lac at Apr 5, 2013 at 4:08 pm
    Yes ,Thanks Gintautas
    If I want create 1000000(1 million) pseudo data,i can this way for it?
    And i hear a gem with called "faker" http://faker.rubyforge.org/
    can i using this gem for solve my problem ( create 1000000 pseudo data)?
    Thanks very much

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Gintautas Šimkus at Apr 5, 2013 at 4:11 pm
    Maybe, I don't know :) you just got to investigate stuff, that's part of
    learning something new process :)


    2013/4/5 haxuan lac <lists@ruby-forum.com>
    Yes ,Thanks Gintautas
    If I want create 1000000(1 million) pseudo data,i can this way for it?
    And i hear a gem with called "faker" http://faker.rubyforge.org/
    can i using this gem for solve my problem ( create 1000000 pseudo data)?
    Thanks very much

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Pagarbiai,
    Gintautas

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Gintautas Šimkus at Apr 5, 2013 at 4:12 pm
    Though just simple db:seed and then exporting development DB and importing
    it into test DB should do the trick.


    2013/4/5 Gintautas Šimkus <dihitales@gmail.com>
    Maybe, I don't know :) you just got to investigate stuff, that's part of
    learning something new process :)


    2013/4/5 haxuan lac <lists@ruby-forum.com>
    Yes ,Thanks Gintautas
    If I want create 1000000(1 million) pseudo data,i can this way for it?
    And i hear a gem with called "faker" http://faker.rubyforge.org/
    can i using this gem for solve my problem ( create 1000000 pseudo data)?
    Thanks very much

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Pagarbiai,
    Gintautas


    --
    Pagarbiai,
    Gintautas

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Greg Akins at Apr 5, 2013 at 4:14 pm
    huxuan

    Faker might be overkill.. or might not. Try both approaches and let us
    know which works best.

    If you have ActiveRecord model defined (say User.rb)

    Then just include this in the db/seed.rb

    [0..1000000].each do |i|
    User.create(:name => "name#{i}", etc...)
    end

    A problem with this approach is distribution of data. If you need the
    names to be distributed across an alphanumeric range (to mimic real world
    data) then you might want to modify the mechanism for creating the User.


    Greg Akins
    http://twitter.com/akinsgre


    On Fri, Apr 5, 2013 at 12:08 PM, haxuan lac wrote:

    Yes ,Thanks Gintautas
    If I want create 1000000(1 million) pseudo data,i can this way for it?
    And i hear a gem with called "faker" http://faker.rubyforge.org/
    can i using this gem for solve my problem ( create 1000000 pseudo data)?
    Thanks very much

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Manish Chakravarty at Apr 8, 2013 at 3:34 pm
    Write a Ruby script to do it, invoke it via a rake task.
    On Fri, Apr 5, 2013 at 9:38 PM, haxuan lac wrote:
    Yes ,Thanks Gintautas
    If I want create 1000000(1 million) pseudo data,i can this way for it?
    And i hear a gem with called "faker" http://faker.rubyforge.org/
    can i using this gem for solve my problem ( create 1000000 pseudo data)?
    Thanks very much

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Best,
    Manish Chakravarty

    Blog | Twitter | LinkedIn

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Haxuan lac at Apr 5, 2013 at 4:22 pm
    Thank Gintautas,Greg Akins very much
    I will do with instruction of you.
    Thank you vey much again!!!

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sean L. at Apr 5, 2013 at 4:39 pm

    haxuan lac wrote in post #1104574:
    I want to test performance of project.
    So i want make 10000 record of table for testing.
    I don't know how to ganerate record.
    Who can help me? Thanks.
    Look at rails cast #179.
    this has a tutorial on using seed.rub to create test data.

    http://railscasts.com/episodes/179-seed-data?view=comments

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Haxuan lac at Apr 6, 2013 at 2:19 am
    I tried create 10000 pseudo by Faker but it's very slow.
    I fake 1000 record about 20 minutes.
    And 10000 record take me 2-3 hours.
    please give me some advice about this time I had done with fake pseudo
    data(1000 and 10000 pseudo).
    Thanks..............

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Colin Law at Apr 6, 2013 at 8:21 am

    On 6 April 2013 03:18, haxuan lac wrote:
    I tried create 10000 pseudo by Faker but it's very slow.
    I fake 1000 record about 20 minutes.
    And 10000 record take me 2-3 hours.
    please give me some advice about this time I had done with fake pseudo
    data(1000 and 10000 pseudo).
    I think it has been suggested several times that you use rake db:seed
    with seed.rb. Have you investigated that route?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tamouse at Apr 6, 2013 at 9:26 am

    On Apr 5, 2013 9:18 PM, "haxuan lac" wrote:
    I tried create 10000 pseudo by Faker but it's very slow.
    I fake 1000 record about 20 minutes.
    And 10000 record take me 2-3 hours.
    please give me some advice about this time I had done with fake pseudo
    data(1000 and 10000 pseudo).
    Thanks..............
    anytime you use the ORM to insert 10_000 records it's going to be slow as
    it does them one at a time. i suggest gong the direct sql route in this
    case.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tonypm at Apr 14, 2013 at 4:35 pm
    One approach may be to build the data as a large csv. Which you could do
    from ruby if you wished and you can then keep as a file. Then either
    import directly to the db with sql or workbench etc. or if you want to stay
    ruby, load the csv and use ar_extension import to dump the data into the
    db.

    On Friday, 5 April 2013 16:08:04 UTC+1, Ruby-Forum.com User wrote:

    I want to test performance of project.
    So i want make 10000 record of table for testing.
    I don't know how to ganerate record.
    Who can help me? Thanks.

    --
    Posted via http://www.ruby-forum.com/.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sZheFpnQ2wkJ.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedApr 5, '13 at 3:08p
activeApr 14, '13 at 4:35p
posts18
users9
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase