Efficient way to select random nodes

Author Message

Christian Johansen

Wednesday 21 June 2006 5:40:45 am

Has anyone got an efficient way to fetch random nodes? The way I'm doing it now is to fetch nodes and pipe it through to the shuffle operator. It works, sure, but often I end fetching ALOT more nodes than I actually need. Is there a simple way to select only the desired amount of nodes randomly from the database directly? Do I have to create som custom filter for this?

Łukasz Serwatka

Wednesday 21 June 2006 6:59:22 am

Hei,

This topic might be useful:
http://ez.no/community/forum/setup_design/how_to_fetch_random_content_3_8/re_how_to_fetch_random_content_3_8

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:18:18
Script start
Timing: Jan 18 2025 19:18:18
Module start 'layout'
Timing: Jan 18 2025 19:18:18
Module start 'content'
Timing: Jan 18 2025 19:18:19
Module end 'content'
Timing: Jan 18 2025 19:18:19
Script end

Main resources:

Total runtime0.8311 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0298 589.4766152.6406
Module start 'layout' 0.02980.0076 742.117239.4766
Module start 'content' 0.03740.7921 781.5938524.2813
Module end 'content' 0.82950.0015 1,305.87508.2969
Script end 0.8310  1,314.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4928160.0003
Check MTime0.00150.1823160.0001
Mysql Total
Database connection0.00200.235110.0020
Mysqli_queries0.759291.3534540.0141
Looping result0.00070.0836520.0000
Template Total0.740489.120.3702
Template load0.00180.222220.0009
Template processing0.738588.861620.3692
Template load and register function0.00030.031610.0003
states
state_id_array0.00410.498510.0041
state_identifier_array0.00260.313720.0013
Override
Cache load0.00150.176390.0002
Sytem overhead
Fetch class attribute can translate value0.00060.069420.0003
Fetch class attribute name0.00190.232530.0006
XML
Image XML parsing0.00080.091720.0004
class_abstraction
Instantiating content class attribute0.00000.003530.0000
General
dbfile0.00120.1450180.0001
String conversion0.00000.002040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs