ID的負荷有我使用的是PDO :: MySQL的搜索在MySQL中
<?php
$ids = array(1, 3, 4, 5, 6, 7, 23, 24, 26, 28); // example, this can hold up to 1000 unique id's
$results = array();
$stmt = $pdo->prepare("SELECT a, b, c FROM table WHERE id = ?");
foreach($ids as $id) {
$stmt->execute(array($id));
$results[] = $stmt->fetch(PDO::FETCH_ASSOC);
}
?>
難道我真的要放這一個方式,或者多個快速查詢?:
環標識的,並與擴展基本的查詢,使其顯示爲:
SELECT a, b, c, FROM table WHERE id = ? OR id = ? OR id = ? //etc
更快990ms ... – 2012-03-07 00:18:42