When entering the page, the following code is triggered.
$post = $pdo->prepare('SELECT * FROM app WHERE id = ? AND url = ?'); $post->execute(array($id,$url)); $game = $post->fetch(PDO::FETCH_LAZY); $views = $pdo->prepare('UPDATE app SET views=views+1 WHERE id = ?'); $views->execute(array($id)); - If several users simultaneously log into the page, will the
viewsfield be correct? That is, 10 people opened the page at the same time. Then theviewsfield will refresh 10 times in the order of the queue? - On account of the first request. If I set the index to the
urlfield, will the selection be faster?
id, urlis needed. Two indexes cannot be used simultaneously by mysql, only one will be selected. so it makes sense in this one index and include both fields - Mikeurlmade for guarantees, all of a sudden some wrongidwill choose - emtecif