in reply to Re: Need advice how to diagnose the problem when syntax using MAX() is correct according to MySQL monitor, but errors out in DBI
in thread [SOLVED] Need advice how to diagnose the problem when syntax using MAX() is correct according to MySQL monitor, but errors out in DBI

Well, that's very opinionated take on what he's trying to accomplish. I have some "select max(id)" queries in production right now, for the purpose of monitoring whether a database has had any new records added to certain tables, and sets off alarms if they stop changing within a certain time window. It's a nice efficient query, and applicable to a very large percentage of table designs.
  • Comment on Re^2: Need advice how to diagnose the problem when syntax using MAX() is correct according to MySQL monitor, but errors out in DBI
  • Download Code

Replies are listed 'Best First'.
Re^3: Need advice how to diagnose the problem when syntax using MAX() is correct according to MySQL monitor, but errors out in DBI
by cavac (Prior) on Nov 24, 2025 at 14:49 UTC

    Similar in my case. I use PostgreSQL and a lot of tables have BIGSERIAL as primary key (bigint automatically generated by a sequence). Yes, seuqnces may have "holes" and are not always perfectly in time order (depending on the transactions that generated them), but a "ORDER BY article_id DESC LIMIT 10" gives a nice overview of the last vew additions to a table.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
    Also check out my sisters artwork and my weekly webcomics