[sqlite] optimizing out function calls

2005-11-12 Thread Nathan Kurz
h the SQLite code so far. If I'm not missing something obvious, hints on where to look at writing a patch for this would be appreciated. Thanks! Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] optimizing out function calls

2005-11-12 Thread Nathan Kurz
On Sat, Nov 12, 2005 at 10:01:29PM -0700, Nathan Kurz wrote: > SELECT uid, match("complex", "function", vector) FROM vectors AS match > ORDER BY match DESC LIMIT 20; Please pardon the silly typo. I do have the AS in the right spot. SELECT uid, match("complex

Re: [sqlite] optimizing out function calls

2005-11-13 Thread Nathan Kurz
On Sun, Nov 13, 2005 at 07:30:58AM -0500, [EMAIL PROTECTED] wrote: > Nathan Kurz <[EMAIL PROTECTED]> wrote: > > > > SELECT uid, match("complex", "function", vector) AS match FROM vectors > > ORDER BY match DESC LIMIT 20; > > SELEC

[sqlite] aggregate functions and sqlite3_set_auxdata / sqlite3_get_auxdata

2005-11-14 Thread Nathan Kurz
I've just figured out that sqlite3_get_auxdata() and sqlite3_set_auxdata() are designed to be used only with scalar user defined functions. If they are used with aggregate functions, they cause sporadic and mysterious segfaults. In particular, VdbeFunc within the context is not initialized for ag

[sqlite] strlen() and function args (PATCH)

2005-11-15 Thread Nathan Kurz
I've been looking at ways to make user defined functions run with less overhead, and found that OP_STRING and OP_STRING8 arguments are having strlen() called on them every time the function is invoked. Attached is a tiny patch that causes expr.c to pass the length of the argument as P1 and also ca

Re: [sqlite] Issue with sqlite3_result_error inside aggregatefunction

2005-11-16 Thread Nathan Kurz
On Wed, Nov 16, 2005 at 01:16:40PM +0100, Florian Weimer wrote: > * D. Richard Hipp: > > > If an error occurs in a step function, record that fact in > > the aggregate context. Then when the finalizer is called, > > check the error flag in the context and call sqlite3_result_error > > at that poi

[sqlite] pragma to load shared libraries (PATCH)

2005-11-16 Thread Nathan Kurz
On Wed, Nov 16, 2005 at 10:22:42AM +, Robin Breathe wrote: > Nathan Kurz wrote: > > I'm using a computationally expensive user defined function called > > 'match()'. In case it makes a difference, match() is written in C, > > and for testing, I'

[sqlite] functions that return tables

2005-11-18 Thread Nathan Kurz
my application, and generate a new query, but ideally I'd like to do this in one step. Is there any reasonable way to accomplish this? Or am I left with defining a new function type that returns a handle to a temp table, and new parsing logic to wrap the right OP codes around that functi

Re: [sqlite] functions that return tables

2005-11-18 Thread Nathan Kurz
On Fri, Nov 18, 2005 at 05:43:01PM +0100, Noel Frankinet wrote: > >My current workaround is to have my function return a comma separated > >list of values ("10,9,8"), parse this string in my application, and > >generate a new query, but ideally I'd like to do this in one step. > > why not a vector

Re: [sqlite] functions that return tables

2005-11-21 Thread Nathan Kurz
On Fri, Nov 18, 2005 at 04:25:12PM -0700, Dennis Cote wrote: > >Is there any reasonable way to accomplish this? Or am I left with > >defining a new function type that returns a handle to a temp table, > >and new parsing logic to wrap the right OP codes around that function? > > I don't know of a

Re: [sqlite] Are my assumptions about the implyed OID valid?

2005-11-23 Thread Nathan Kurz
On Thu, Nov 24, 2005 at 01:35:56AM +0100, Michael Scharf wrote: > -- The user sorts on NUMBER and selects NAME that > -- start with 'foo'. I create a temp table view1. Are you always using a LIKE pattern that starts with a fixed string, or is the wildcard sometimes first? If it's always fixed, yo

[sqlite] Examples of outside access to sqlite btree files?

2005-11-23 Thread Nathan Kurz
clear, but necessarily quite complex. Looking through the archives, I've seen several mentions of people working on such things, but no mention of their completion. Paul G or Joseph Stewart: any updates on your respective endeavors? Thanks! Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] problem with blobs (perl code)

2005-11-30 Thread Nathan Kurz
On Wed, Nov 30, 2005 at 04:36:30PM -0600, Jim Dodgen wrote: > I am having a problem with blobs, I seem to insert ok but only get three (3) > bytes when I query it back. yes I am setting LongReadLen. any ideas? The Perl interface through DBD-SQLite-1.09 is broken with regard to blobs. It binds th

Re: [sqlite] problem with blobs (perl code)

2005-11-30 Thread Nathan Kurz
On Wed, Nov 30, 2005 at 05:10:19PM -0600, Jim Dodgen wrote: > > What do you get back (using the command-line client) when you > > ask for LENGTH(x) or QUOTE(x) instead of just the column x? > > sqlite> select length(val) from foo; > 3 > sqlite> select quote(val) from foo; > 'MZP' > > strange, rep

Re: [sqlite] problem with blobs (perl code)

2005-12-01 Thread Nathan Kurz
On Thu, Dec 01, 2005 at 10:13:24AM -0500, Matt Sergeant wrote: > On 30 Nov 2005, at 17:59, Nathan Kurz wrote: > > >The Perl interface through DBD-SQLite-1.09 is broken with regard to > >blobs. It binds the result as text, thus doesn't handle NUL's. > > This

Re: [sqlite] problem with blobs (perl code)

2005-12-01 Thread Nathan Kurz
On Thu, Dec 01, 2005 at 09:52:25PM -0500, [EMAIL PROTECTED] wrote: > Suppose you do this: > >sqlite3_bind_text(pVm, 1, "abc\000xyz\000pq", 10, SQLITE_STATIC); > > If this is part of an INSERT, say, then you will insert a 10-character > string that happens to contain a couple of extra \000 cha

[sqlite] segfaults on aggregate functions in where clause?

2005-12-02 Thread Nathan Kurz
I was just about to file a bug about a segfault when I have an aggregate in the where clause like: select id from test where avg(rating) > 10 group by id; But when I looked in the bug reports, I found that several similar bugs had been reported and that the problem had been 'fixed': http:/

Re: [sqlite] Re: segfaults on aggregate functions in where clause?

2005-12-02 Thread Nathan Kurz
On Fri, Dec 02, 2005 at 11:24:10PM -0500, Igor Tandetnik wrote: > It is indeed an illegal SQL query. You probably want > > select id from test > group by id > having avg(rating) > 10; I hadn't realized that my query was actually illegal. OK. > >The workaround of putting the aggregate in a subse

Re: [sqlite] problem with blobs (perl code)

2005-12-05 Thread Nathan Kurz
On Mon, Dec 05, 2005 at 08:23:19AM -0500, [EMAIL PROTECTED] wrote: > > OK, so 1.11 is on CPAN which fixes this. However I have another bug > > report about this not working for user defined functions, where I do > > this: > > > > s = SvPV(result, len); > > sqlite3_result_text(

Re: [sqlite] Probably not simple question

2005-12-07 Thread Nathan Kurz
On Wed, Dec 07, 2005 at 08:49:42PM +0100, [EMAIL PROTECTED] wrote: > Hello, > I have a following problem. > In my program I have a vector of elements let say defined as follow: > > struct intDouble { > int x; > int y; > }; It's pretty straightforward, presuming you've already figured out the

[sqlite] sorting according to a value list?

2005-12-07 Thread Nathan Kurz
Is there any way to sort according to the order of a value-list that is specified with 'IN' according to the list? I've got something like: SELECT iid, title FROM titles WHERE iid IN (1168,80,2934,581,1631); Is it possible to get the results back in the order specified in the value list: 1168,80

Re: [sqlite] Probably not simple question

2005-12-07 Thread Nathan Kurz
On Wed, Dec 07, 2005 at 08:34:46PM -0800, Dan Kennedy wrote: > > To make it work in more than a superficial manner, you probably will > > need a good understanding of how structures are internally represented > > in C++ or C. You pass sqlite a pointer to the struct and tell it how > > long it is (

Re: [sqlite] Speed of a count operation

2005-12-08 Thread Nathan Kurz
On Thu, Dec 08, 2005 at 12:26:44PM -0500, Teg wrote: > I have a 6.5 gb database with 29,587 records in it. It takes about > 30-40 seconds for a count to return the first time I specify one in > "Sqlite3" (seeing this in my program as well). Subsequent "count" > operations are nearly instantaneous e

Re: [sqlite] About Index using

2005-12-11 Thread Nathan Kurz
On Mon, Dec 12, 2005 at 09:48:21AM +0800, Bo Lin wrote: > Here is a sql string ,like : select * from test where (a=0 or a=1) > and b=1 ; and column a range from 1-1, and column b range from > 0-1. and DB has about 300,000 record with colum a and b configured > randomly . > > Two index is creat

Re: [sqlite] Can't commit transaction - SQL statements in progress

2005-12-12 Thread Nathan Kurz
On Mon, Dec 12, 2005 at 06:55:24PM -0500, [EMAIL PROTECTED] wrote: > Eric Scouten <[EMAIL PROTECTED]> wrote: > > Or to put it another way, this is essentially a memory leak problem. > > SQLite obviously knows that I've lost track of one or more prepared > > statements that haven't run to completi

Re: [sqlite] returning multiple rows from custom functions

2005-12-15 Thread Nathan Kurz
On Thu, Dec 15, 2005 at 09:17:48PM +, Andrew McDermott wrote: > For example, I'm currently computing a histogram in application code for > a moderately sized table (7+ million rows), but I'm wondering whether it > would be quicker to get the results computed via a custom SQLite > function. I'm

Re: [sqlite] Re: Padding with zeros

2005-12-29 Thread Nathan Kurz
On Fri, Dec 30, 2005 at 12:21:05AM +, Brian Johnson wrote: > I have a field of text and I want to prefix the that text with numbers padded > with zeroes. > > eg currently > text 1 > text 2 > text 3 > > to become > 001 text 1 > 002 text 3 > 003 text 2 > > or ultimately > b001 text 1 > b002 te

Re: [sqlite] Functions

2006-01-17 Thread Nathan Kurz
> Was looking on the functions code. Wondered if their's any way I can > do something like > > for select from table > > do something here > > loop > > the field have a array of data may be single row but only single column Hi Vishal -- I'm not sure I understand your syntax. Maybe a more c

Re: [sqlite] Does anyone know how I would uninstall sqlite?

2006-01-21 Thread Nathan Kurz
> twoeyedhuman wrote: > > I have the latest version of sqlite3 on my debian box and I'd like > > to uninstall it because I keep getting this error through bash: > > sqlite3: error while loading shared libraries: libsqlite3.so.0: > > cannot open shared obje ct file: No such file or directory I'm > >

[sqlite] DBD:SQLite and sqlite3_column_decltype()

2006-02-09 Thread Nathan Kurz
if the table is created without an explicit type, instead of the "" or "TEXT" that I would have expected. Is this correct? Or should it return something else? Thanks! Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] Compatability issues with DBD::SQLite and SQLite v3.3.3 and 3.3.4

2006-03-06 Thread Nathan Kurz
e recent change to sqlite is not yet reflected in DBD::SQLite. 'make test' for DBD::SQLite is another fine test program that fails. Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] Re: concers about database size

2006-03-16 Thread Nathan Kurz
On Thu, Mar 16, 2006 at 11:34:31AM -0600, Jay Sprenkle wrote: > > > You may legitimately need one really large table but most applications > > > don't. > > Too bad. My guess is that you're doing the right thing trying to consolidate. > It's going to take expensive hardware no matter what you end u

Re: [sqlite] Performance & database design

2006-03-21 Thread Nathan Kurz
e entire backend rather than just making small changes. Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] DBD Sqlite

2006-04-04 Thread Nathan Kurz
> >> 3. The performance for inserts is really bad. Around 40k entries takes a > >>few hours. What might I be doing wrong? I do a commit after > >>all the inserts. > > > > A few things to help with speed: > > > > 1. Use DBI's prepared statements; eg, 1 prepare() and many execute(). > > Yes

Re: [sqlite] DBD Sqlite

2006-04-04 Thread Nathan Kurz
On Tue, Apr 04, 2006 at 04:18:35PM -0700, Sripathi Raj wrote: > On 4/4/06, Nathan Kurz <[EMAIL PROTECTED]> wrote: > > > > > >> 3. The performance for inserts is really bad. Around 40k entries > > takes a > > > >>few hour

Re: [sqlite] Re: what is faster?

2006-04-15 Thread Nathan Kurz
a lot of data". For some people, a lot of data is 100,000 small records, for some it means terabytes. It's difficult for anyone to answer without knowing more specifics. Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] Low Level API for SQLite3

2006-05-10 Thread Nathan Kurz
ion. Here's a link that expresses this more tactfully than I can: http://www.slash7.com/pages/vampires Nathan Kurz [EMAIL PROTECTED]

[sqlite] Relative efficiency of joins, subselects, and union/intersect

2005-02-22 Thread Nathan Kurz
s not?) Is there a standard pattern for doing this sort of cascade? My guess is that there are probably a lot of ways of solving this problem, but that one of them is going to be strikingly more efficient than the others, and which one is best might be specific to SQLite. Thanks for any suggestions,

Re: [sqlite] Relative efficiency of joins, subselects, and union/intersect

2005-02-23 Thread Nathan Kurz
all client program accessible via a hot key (short-lived). So I think that having the XML file as a primary store might not work well for me (at least from the short-lived client). But maybe I'm not really understanding the advantages of the in-memory database. Is it in some way inherently faster on lookups than just setting SQLite to use a really large cache? Thanks! Nathan Kurz [EMAIL PROTECTED]

Re: [sqlite] BerkleyDB pager?

2005-07-03 Thread Nathan Kurz
On Sun, Jul 03, 2005 at 02:14:45PM -0400, Andrew Athan wrote: > >>I'm investigating embedded databases for an upcoming project, and I came > >>upon this thought: Wouldn't an SQLite pager that uses > >>Sleepycat/BerkleyDB be quite interesting? Maybe you could clarify a bit more what you are propos