Forums / Developer / fetch all users / performance

fetch all users / performance

Author Message

Gernot Rief

Tuesday 09 December 2003 4:33:59 am

hi!

i use the following code:
<select name="{$attribute_base}_ml_goto_{$attribute.id}[]" multiple size="25">

{section loop=fetch( content, list, hash( parent_node_id, 5,depth, 2, class_filter_type, "exclude", class_filter_array, array(3) ))}

<option value="{$:item.contentobject_id}"
{section show=and($attribute.content.uids|contains($:item.contentobject_id),is_array($attribute.content.uids))}selected="selected"{/section}
>{$:item.name|wash} ({$:item.data_map.user_account.content.email})

</option>

{/section}

</select>

= fetch all users into a selectbox and mark the users in $attribute.content.uids (=array of contentobject_ids) as selected.

the code works, but for 450 users it takes about 90 sec (!) to display the page (90% in template)

has anyone any idea how to speed this up?

thx, gernot

Sascha Frinken

Tuesday 09 December 2003 11:05:15 am

450 items (users) are too much for an option list.

You should consider creating a browse page, with a seach function and not more than 50 users per page. After choosing the user(s) from there you return back to where you need it.

You could also write an template operator that fetches the user info directly from the database which will speed things up.

hth

Sascha

Gernot Rief

Tuesday 09 December 2003 11:41:39 pm

hi!

thx for the answer.

writing an operator fixed my prob

gernot

Marco Zinn

Wednesday 10 December 2003 12:41:29 pm

Hi,
do you mind sharing the operator?
I have 7000 users and about 5000 are in one group.
Until now, i don't have to select users in a template dropdown, but it's just a matter of time.

BTW: Doesn't the workflow system (approval) use dropdown-list for users? Or does this use user groups?

Marco
http://www.hyperroad-design.com