Eggcorn Database

The Eggcorn Database is a novel use of WordPress for something that isn’t a blog at all. A great testament to the flexibility of 1.5.

7 thoughts on “Eggcorn Database

  1. Sorry, I didn’t see the comments about the queries first, but I should comment here (I’m the author/maintainer of the Eggcorn Database).

    The problem that the /browse-eggcorn/ page exhibited (and all the others, just less severely; the front page hat 167 queries; down to 21 now) comes from WP. On /browse-eggcorn/ i call basically `get-archives(type=’posttopost’)` twice: once in the sidebar, and once in the main body, where all entries are listed — and many of them twice or more. In reality, these are ‘my’ functions, but heavily cribbed on `get_archives`.

    Now you’ll have to believe me, but the excessive db queries don’t come from what I’ve changed, but from the call to `get_permalink()`in the loop that formats the output. `get permalink()` needs two db queries for every link (ouch!!) if you have ‘pretty’ permalinks enabled: one to determine the author of the post (it is passed the ID), and one for the category. The first one is totally superfluous for a blog without `%author%` in the permalink structure; the second is also really really expensive for what it achieves.

    My suggestion would be to create the permalinks for each post once and for all, to store them in the post table, to update them only if the permalink structure is changed, and to retrieve them with all the rest of the postdata when posts are assembled for display.

    Sure, I should file this as a bug — this must have contributed to the mysql overload for some of the blogs brought down by referrer spam lately –, but I’d have to take a look at 1.5 final first 🙂 … not time to upgrade.

SHARE YOUR THOUGHTS