Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue on onetomany relations #116

Closed
Robino opened this issue Jun 7, 2014 · 2 comments
Closed

Performance issue on onetomany relations #116

Robino opened this issue Jun 7, 2014 · 2 comments

Comments

@Robino
Copy link

Robino commented Jun 7, 2014

Hello,

I would like to have the UOM_ID for all my products with this code but it is really too slow.
If I just find all my products it's fast. But when I read information on uom_id relations it's slow.

require 'rubygems'
require 'ooor'
Ooor.logger.level = 0   
Ooor.new(:url => 'http://xxxxxxxxx.com:8069/xmlrpc', :database => 'production', :username => 'my_username', :password => 'my_password')

ProductProduct.find(:all, :fields=>["id","name","description","uom_id.name","list_price","ean13","manufacturer.name","manufacturer_pref","standard_price"]).each do |mypc|
    puts mypc.id.to_s + '|' + mypc.name.to_s + '|"' + mypc.description.to_s.gsub("\n", "") + '"|' + mypc.list_price.to_s + mypc.ean13.to_s + mypc.uom_id(:fields => ["name"]).name.to_s

end 
Results (with time):
D, [2014-06-07T07:24:02.400171 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: fields_get, *args: [false, {}]
D, [2014-06-07T07:24:02.665786 #2057] DEBUG -- : 84 fields loaded in model 
D, [2014-06-07T07:24:02.691654 #2057] DEBUG -- : OOOR object service: rpc_method: search_read, db: production, uid: 11, pass: #, obj: product.product, method: search_read, *args: [{:fields=>["id", "name", "description", "uom_id.name", "list_price", "ean13", "manufacturer.name", "manufacturer_pref", "standard_price"], :offset=>0, :limit=>false, :domain=>[], :sort=>false, :context=>{}}]
D, [2014-06-07T07:24:03.318612 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[2], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:03.498252 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: fields_get, *args: [false, {}]
D, [2014-06-07T07:24:03.672666 #2057] DEBUG -- : 6 fields loaded in model 
D, [2014-06-07T07:24:03.683952 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[5], ["name"], {}]
2|Service|""|75.0Hour(s)
D, [2014-06-07T07:24:03.855449 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[32], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:04.032154 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
32|Ventrèche de Thon germon huile bio|"La ventrêche de thon est la partie la plus grasse du poisson. C'est elle qui contient les fameux Omega 3. Le poisson provient de la criée de Saint Jean de Luz Ciboure au Pays Basque. 140 gr<br>"|7.93760164640067Unit(s)
D, [2014-06-07T07:24:04.204995 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[7], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:04.382517 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
7|EKIA Nature|"Dégustez un yaourt artisanal délicatement préparé avec le lait de nos 3 fermes.<br>"|2.13760206160119Unit(s)
D, [2014-06-07T07:24:04.556920 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[9], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:04.748887 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
9|EKIA Citron|"Dégustez un yaourt artisanal délicatement préparé avec le lait de nos 3 fermes."|2.253760206160133Unit(s)
D, [2014-06-07T07:24:04.932237 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[35], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:05.113359 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
35|Sardines à l'huile Bio et Citron Bio|"Les sardines sont faites selon la plus ancienne méthode qui date de 1804 (du temps des "Penn Sardin"): elles sont d'abord salées puis séchées pendant 3 jours avant d'être mise en verrine crues. Elles conservent ainsi tout leur goût. Elles ne sont pas frites. Nos clients les trouvent plus digestes. L'avantage du bocal est qu'il ne contient pas de bisphénol et qu'il peut se refermer. Un bocal équivaut à 3 boites. Il se conserve 1 mois après ouverture au réfrigérateur.<br><br>"|8.9Unit(s)
D, [2014-06-07T07:24:05.286458 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[114], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:05.469604 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
114|Pâte Pressé 500g |"poids : 500 gr&nbsp; <br>              <style type="text/css">P { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); widows: 2; orphans: 2; }</style><p style="margin-bottom: 0.28cm">Lait de brebis entier et pasteurisé,présure, ferments lactiques, Cacl2.</p><br><br>"|10.0Unit(s)
D, [2014-06-07T07:24:05.662763 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[149], ["uom_id"], {"fields"=>["name"]}]
D, [2014-06-07T07:24:05.845368 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.uom, method: read, *args: [[1], ["name"], {}]
149|BIERE BLONDE AKERBELTZ "ORAILA"|"Cette bière légère et fruitée doit son arôme particulier à l'emploi d'un houblon traditionnel des bières de l'Est de l'Europe dont le peuple basque pourrait être originaire.<br>La Blonde d'Akerbeltz se déguste fraîche et très fraîche.<br><br><br>"|5.56Unit(s)
D, [2014-06-07T07:24:06.019495 #2057] DEBUG -- : OOOR object service: rpc_method: execute, db: production, uid: 11, pass: #, obj: product.product, method: read, *args: [[106], ["uom_id"], {"fields"=>["name"]}]
@Robino
Copy link
Author

Robino commented Jun 11, 2014

Hello,
Just for my information,

@Robino Robino closed this as completed Jun 11, 2014
@Robino
Copy link
Author

Robino commented Jun 11, 2014

Hello,

My issue was becaus I was using puts command to see results.... sorry everything is working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant