Very useful comments in this thread. I recommend adding this to the SQLite FAQ, 
if it exists.

Craig H Maynard
Rhode Island, USA

> Date: Tue, 8 May 2018 20:56:45 -0400
> From: Richard Hipp <>
> To: SQLite mailing list <>
> Subject: Re: [sqlite] Stored Procedures
> Message-ID:
>       <>
> Content-Type: text/plain; charset="UTF-8"
> On 5/8/18, Jens Alfke <> wrote:
>>> On May 8, 2018, at 1:02 PM, Mike Clark <> wrote:
>>> Has there been any thought of implementing some kind of stored procedure
>>> feature for SQLite?
>> That's more of a server thing. In an embedded database, a stored procedure
>> is literally a function in your programming language, which runs a SQLite
>> query.
> Right.
> To amplify Jens' remark:  In a traditional client/server database,
> there is high latency in the round-trip message from client to server
> and back again.  To work around this, client/server systems provide
> stored procedures in which lots of little SQL statements can be
> embedded, and then all run together in a single round-trip.  But with
> SQLite, there is no round-trip latency.  A "round-trip" to and
> database is just a function call, and is very very cheap.  This one
> fact removes a lot of the motivation behind having stored procedures.
> The other benefit of stored procedures is that it provides a way to
> code up a common operation once (correctly!) and store it in the
> database, rather than having multiple clients all have to work out the
> operating themselves (some of them perhaps incorrectly).  The usual
> way of handling that in SQLite is to store a script in a text column
> someplace, then execute them as needed.  SQLite began life as a TCL
> extension, and so naturally TCL scripts work very well for this kind
> of thing.
> -- 
> D. Richard Hipp

sqlite-users mailing list

Reply via email to