vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Forum Home Enhancements - Random Thread (https://vborg.vbsupport.ru/showthread.php?t=193061)

tirol07 10-17-2008 09:40 PM

Quote:

Originally Posted by GWLiaR (Post 1640220)
D?zelttim..
Added JPEG Demo :)

bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?

GWLiaR 10-18-2008 03:54 AM

Quote:

Originally Posted by tirol07 (Post 1647317)
bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?

Evet M?mk?n...Mysal ile Yapabilirsin:)

tirol07 10-19-2008 08:09 PM

Quote:

Originally Posted by GWLiaR (Post 1647446)
Evet M?mk?n...Mysal ile Yapabilirsin:)

Peki nasıl yaplıyor bu mysal dediğin?

Detaylı anlatabilirmisin sana zahmet, ?ok uğraştım yapamadım?

KrisP 11-14-2009 12:31 PM

Quote:

Originally Posted by ahtapod (Post 1640507)
It runs wrong.

When used, it transfers users to wrong thread. :(

In plugin change

Quote:

$ryaz.="<a href=showthread.php?p=$veri[threadid]>$baslik</a>";
to

Quote:

$ryaz.="<a href=showthread.php?t=$veri[threadid]>$baslik</a>";

Brandon Sheley 06-06-2010 04:19 AM

It would be handy if this worked properly, I could use it.
Does anyone know of a 3.8 version?

PS... I think the rules say you have to speak in english, or at least have an english version.

valdet 08-12-2011 11:21 AM

Sorry to bump this thread.

Quote:

Originally Posted by noppid (Post 1640311)
That query will/could bring a forum to it's knees running every page view.

Code:

mysql> explain Select * From thread order by rand() DESC LIMIT 1
    -> ;
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows | Extra                          |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
|  1 | SIMPLE      | thread | ALL  | NULL          | NULL | NULL    | NULL | 6026 | Using temporary; Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
1 row in set (0.03 sec)

As you can see, a full table walk.

Here's a better way.

Code:

60*60 == 3600
3600*24 == 14400
14400*30 == 432000
1223479602 - 432000 == 1223047602

mysql> explain Select * From thread where dateline >= 1223047602 order by dateline DESC limit 1;
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table  | type  | possible_keys | key      | key_len | ref  | rows | Extra      |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
|  1 | SIMPLE      | thread | range | dateline      | dateline | 4      | NULL |  104 | Using where |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
1 row in set (0.00 sec)

See the difference? Gotta use those indexes. Rand() is bad.

Can you please let me know how would I optimize this query so it doesn't overload the database as much as with rand() function.

Also how to add the limitations so it does not opens threads from private forums?

Thanks


All times are GMT. The time now is 03:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00996 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete