From: Eric Wong <e@80x24.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: meta@public-inbox.org
Subject: Re: SQLite, UPDATE, and LIMIT
Date: Thu, 22 Feb 2018 23:24:00 +0000 [thread overview]
Message-ID: <20180222232400.GA25726@whir> (raw)
In-Reply-To: <20180222161414.24d305f1@lwn.net>
Jonathan Corbet <corbet@lwn.net> wrote:
> So I'm messing with public-inbox a bit. I had to make the following
> change before things would work on my Fedora system. (This is with
> v1.0.0).
>
> The symptom was errors out of SQLite; it wouldn't pass "make test" much
> less work properly. Some digging turns up this:
>
> If SQLite is built with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT
> compile-time option then the syntax of the UPDATE statement is
> extended with optional ORDER BY and LIMIT clauses as follows
>
> Evidently, Fedora does not enable that option.
Odd; I didn't know about that option and don't know if there's
performance implications for this.
So with your patch, is everything else good on Fedora?
> Now, I assume that LIMIT is there for a reason; I've not even tried to
> look at the schema that public-inbox uses yet. But I thought I would toss
> this out there to see you thought. Perhaps what I really need to do is to
> ask Fedora to turn that option on?
Using LIMIT is probably just a habit of mine.
> --- a/lib/PublicInbox/Msgmap.pm
> +++ b/lib/PublicInbox/Msgmap.pm
> @@ -57,7 +57,7 @@ sub meta_accessor {
> $prev = $dbh->selectrow_array($sql, undef, $key);
>
> if (defined $prev) {
> - $sql = 'UPDATE meta SET val = ? WHERE key = ? LIMIT 1';
> + $sql = 'UPDATE meta SET val = ? WHERE key = ?';
`key' is the primary key anyways, so it should be fine to remove
LIMIT, there. Will apply.
> $dbh->do($sql, undef, $value, $key);
> } else {
> $sql = 'INSERT INTO meta (key,val) VALUES (?,?)';
next prev parent reply other threads:[~2018-02-22 23:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 23:14 SQLite, UPDATE, and LIMIT Jonathan Corbet
2018-02-22 23:24 ` Eric Wong [this message]
2018-02-22 23:28 ` Jonathan Corbet
2018-02-22 23:33 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180222232400.GA25726@whir \
--to=e@80x24.org \
--cc=corbet@lwn.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).