I'm doing this query at the mysql command line (not through any kind of code)
select count(*) from books where
publisher_id = 46 AND deleted = 0 AND status_id = 3;
Returns 0 (sometimes), but remove the count, it has many results.
What could be causing this? I'm throwing this query at the command line (not through any kind of programming layer)
Explaining count query gives:
Using intersect(IDX_cms_books_publisher_id,IDX_cms_books_status_id,IDX_cms_books_deleted); Using where; Using index
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `books` ADD INDEX `books_idx_publisher_deleted_status_id` (`publisher_id`,`deleted`,`status_id`);
SELECT
count(*)
FROM
books
WHERE
books.publisher_id = 46
AND books.deleted = 0
AND books.status_id = 3