Hi ohad & Lukas,

I checked the database, when I do a host query, one of the postgres thread 
used 100% of CPU, and I am surprised that the sql has so many join:
SELECT DISTINCT "hosts"."id", "hosts"."name" AS alias_0 FROM "hosts" \
 LEFT OUTER JOIN "models" ON "models"."id" = "hosts"."model_id" \
LEFT OUTER JOIN "hostgroups" ON "hostgroups"."id" = "hosts"."hostgroup_id" 
AND "hostgroups"."id" IN (14, 27, 19, 1, 2, 21, 9, 3, 10, 23, 11, 4, 18, 
22) \
LEFT OUTER JOIN "nics" ON "nics"."host_id" = "hosts"."id" AND 
"nics"."primary" = 't' \
LEFT OUTER JOIN "domains" ON "domains"."id" = "nics"."domain_id" AND 
"domains"."id" IN (1) \
LEFT OUTER JOIN "realms" ON "realms"."id" = "hosts"."realm_id" AND 1=0 \
LEFT OUTER JOIN "environments" ON "environments"."id" = 
"hosts"."environment_id" AND "environments"."id" IN (2, 3, 4, 8, 5) \
LEFT OUTER JOIN "architectures" ON "architectures"."id" = 
"hosts"."architecture_id" \
LEFT OUTER JOIN "compute_resources" ON "compute_resources"."id" = 
"hosts"."compute_resource_id" AND 1=0 \
LEFT OUTER JOIN "images" ON "images"."id" = "hosts"."image_id" \
LEFT OUTER JOIN "operatingsystems" ON "operatingsystems"."id" = 
"hosts"."operatingsystem_id" \
LEFT OUTER JOIN "nics"

I think we probably need to tune the sql so it can run a little faster


On Tuesday, September 20, 2016 at 8:16:12 AM UTC+8, sinux shen wrote:
>
> I just simply search a specific hostname in the search bar, for example 
> “foo”, and then have to wait for a long time, normally 20~30 secs, I will 
> try to turn the slow query on and see what happened. 
>
> Thanks 
> -Sinux 
> > On Sep 14, 2016, at 3:59 PM, Lukas Zapletal <l...@redhat.com> wrote: 
> > 
> >> what was the search query that you used? 
> > 
> > And do you experience this when loading "intelligent completion" or when 
> > doing actual query? 
> > 
> > Are you able to enable slow queries logging in your postgres and send us 
> > the output? 
> > 
> > https://wiki.postgresql.org/wiki/Logging_Difficult_Queries 
> > 
> > Easiest is to set log_min_duration_statement to reasonable value (1 
> > second). 
> > 
> > -- 
> > Later, 
> > Lukas #lzap Zapletal 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Foreman users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to foreman-users+unsubscr...@googlegroups.com. 
> > To post to this group, send email to foreman-users@googlegroups.com. 
> > Visit this group at https://groups.google.com/group/foreman-users. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to