We are having what seems like a baffling problem to me.
On occasion, our SELECTs will return zero rows when we know with certainty
that they should be returning at least some rows. No error occurs, the
select just behaves as if the db is empty or something.
The queries on the page are all selects. No inserts or updates so I didn't
see the need for a transaction. I can't see why that would help anyway.
I've included the selects from the page below.
Anyone have an experience like this? Please let me know if more info is
req'd.
SELECT pr_article.title, pr_article.article_id FROM pr_article WHERE
pr_article.article_id = pr_article_age.article_id AND pr_article_age.age_id
= 1 AND pr_article.is_active = true AND pr_article.is_approved = true AND
pr_article.release_date < 982093578 AND ((pr_article.end_date = 0) or
(pr_article.end_date > 982093578 )) ORDER BY pr_article.release_date DESC
LIMIT 2
SELECT pr_article.title, pr_article.article_id FROM pr_article WHERE
pr_article.article_id = pr_article_age.article_id AND pr_article_age.age_id
= 1 AND pr_article.is_active = true AND pr_article.is_approved = true AND
pr_article.release_date < 982093578 AND ((pr_article.end_date = 0) or
(pr_article.end_date > 982093578 )) ORDER BY pr_article.release_date DESC
LIMIT 3
SELECT DISTINCT ON (release_date, article_id) pr_article.title,
pr_article.article_id, pr_cat.prog_name FROM pr_article WHERE
pr_article.article_id = pr_article_age.article_id AND pr_article_age.age_id
= 1 AND pr_article_cat.cat_id=pr_cat.cat_id AND pr_article.article_id =
pr_article_cat.article_id AND pr_article.is_active = true AND
pr_article.is_approved = true AND pr_article.release_date < 982093578 AND
((pr_article.end_date = 0) or (pr_article.end_date > 982093578 )) ORDER BY
pr_article.release_date DESC LIMIT 5
SELECT DISTINCT ON (pr_cat.name) pr_cat.name, pr_cat.prog_name FROM
pr_article, pr_article_age, pr_article_cat, pr_cat WHERE
pr_article_age.age_id = 1 AND pr_article_age.article_id =
pr_article.article_id AND pr_article.article_id = pr_article_cat.article_id
AND pr_article_cat.cat_id = pr_cat.cat_id AND pr_article.is_active = true
AND pr_article.is_audio = false AND pr_article.is_approved = true AND
pr_article.release_date < 982093578 AND ((pr_article.end_date = 0) or
(pr_article.end_date > 982093578 ))
Matt Friedman