MySQL Forums
Forum List  »  PHP

Re: Showing recordsets from tables with one (main table) to many (secondary table) relationship
Posted by: Rick James
Date: January 11, 2011 11:13AM

PRIMARY KEY (`Id`),
UNIQUE KEY `Id` (`Id`)
-- The UNIQUE KEY is redundant, since the PRIMARY KEY is, by definition, a UNIQUE KEY.

SHOW CREATE TABLE tblarticles \G
(and any other tables that are relevant)

innodb_buffer_pool_size | 8388608
-- Change this to be about 70% of _available_ RAM.

select * from tblnombresvernaculos where id=34 order by orden
would like
INDEX(id, orden)

Instead of pre-computing the target, let the next/prev page find it:
variable++;
var pagina="index.php?p="+variable;
-->
// skip this: variable++;
var pagina="index.php?after="+variable;
Then...
    $after = @$_GET['after'];
    if (isset($after))
    {
        $sql = "SELECT ... WHERE id > $after ORDER BY id LIMIT 1;
    }
That way, you fetch one record, not the whole table.

Options: ReplyQuote


Subject
Written By
Posted
Re: Showing recordsets from tables with one (main table) to many (secondary table) relationship
January 11, 2011 11:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.