The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
1) Does not work becasue MAX() is a grouping function
2) Does work, but gives the same output as in Post #3, eg. Table Scan |
#12
|
||||
|
||||
interesting as mysql.com said using force index makes it so it uses indexes only and requires no table scan>_>
maybe substitute FORCE INDEX with USE INDEX |
#13
|
|||
|
|||
[sql]select * from post where postid = (select max(postid) from post)[/sql]But i think this will only work for MySQL 4.1 and up.
Otherwise create 2 queries: 1 to get max postid, and 1 to retrieve the row. Ohh my example is for post table, but should be the same for thread. Also please notice that you should check with a fully loaded table, since the optimizer might decide that if there are only a few rows, it is more efficient to use a full table scan then to use the index. |
#14
|
||||
|
||||
Quote:
[sql]EXPLAIN SELECT * FROM thread ORDER BY threadid DESC LIMIT 1 [/sql] Code:
table type possible_keys key key_len ref rows Extra thread index NULL PRIMARY 4 NULL 82 |
#15
|
||||
|
||||
Quote:
|
#16
|
|||
|
|||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|