Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Aladdin Lampé

Thanks a lot Mike for your detailed answer! I've just read your acticle.
Do you know where I can get the files fs.c and example.c you mention? I've 
been on the FTP (available from www.ddj.com/code/) but I was not able to locate 
any file related to your article :( Could you please send them to me by email 
if they are no longer available online? (genio570 -AT- hotmail DOT fr).
 
It seems like I will be able to further develop the system I described in my 
previous post with the information you mentioned.
 
Another quick question: I planned to develop my own indexing algorithm on the 
external database side. But do you think I could also consider (as another 
option) using the CREATE INDEX sqlite command (involving of course a complete 
scan of the external table's column and then storing the index inside the 
sqlite file)? What would you recommend me to do?
 
In a more general way, I wonder which sqlite SQL commands can involve virtual 
tables and which cannot or should not (for instance for performance reasons, 
etc.).
 
Thanks again for your help,
aladdin Date: Tue, 1 Apr 2008 20:17:54 -0500 From: [EMAIL PROTECTED] To: 
sqlite-users@sqlite.org Subject: Re: [sqlite] Virtual table used to query big 
external database  The main reason why SQLite's practical limit is in the 10s 
of GBs as opposed to TBs (theoretical) is due to how it tracks dirty pages. 
This is described in the Appropriate Uses page 
(http://www.sqlite.org/whentouse.html) but I'll rehash it here for 
convenience. SQLite tracks dirty pages with a bitmap which is allocated before 
each transaction. The size of the bitmap is proportional to the size (not in 
rows but in pages) of the database (256 bytes for every 1Mb of database), so 
as the database grows, the amount of memory allocated before each transaction 
grows. When you get into the GB range, you are starting to allocate in the MB 
range of dirty page map memory per transaction, which starts to take its toll 
on performance.  I could be wrong, but from what I know about virtual tables, 
there is no such correlation between virtual table size and the dirty page 
bitmap, as SQLite has no idea how big a virtual table is, nor does it manage 
the data within the vtable. Furthermore, all SQLite really does in a SELECT 
statement on a vtable is call your code to iterate over it. So really the only 
performance issue is how long it takes your code to iterate over your vtable. 
Thus, your table could be in the TB range, and as long as you are fine with 
iterating over its contents, there is no additional performance issues to 
speak of. There are ways to implement virtual tables such that you can limit 
how much of the table is scanned for certain queries, avoiding having to scan 
the whole thing every time. I wrote an article that touches on this using the 
match() function. Its available online:  
http://www.ddj.com/database/202802959  IMO, virtual tables are one of the 
most powerful and unique features of SQLite. There is a bit of a learning 
curve, but it's amazing what you can do with them. It sounds like you going to 
have to iterate over your external table one way or the other. I see no reason 
why the vtable approach would be any slower than any other approach that 
iterates over the data.  Having said that, while iterating over a large 
vtable is not a big deal (as your program will just step through it one row at 
a time), you need to be careful about getting too fancy with your SQL as you 
may end up triggering a lot of background IO. For example, if you tack on an 
ORDER BY which sorts one of the columns of your vtable, SQLite will end up 
essentially copying the vtable contents into a temporary file and sorting it, 
which may or may not be a strain on your system depending on how big your 
table is (e.g. your vtable is 30Gb and your /tmp folder is on a 10Gb 
partition). So think through what you are doing when going beyond a simple 
SELECT * from big_vtable.  -- Mike  On Tue, Apr 1, 2008 at 3:12 PM, Aladdin 
Lampé [EMAIL PROTECTED] wrote:   Hi all!   Very often, when people 
ask this list why they have trouble managing in sqlite a big table (50 
million lines or more than 10 Go), they are told that sqlite is an embedded 
database and is not meant to be used for very big databases/tables.   I'm 
currently in the process of designing a specific, read-only, sqlite virtual 
table in order to enable sqlite to access data stored in an external database 
which is specially designed to handle very big tables.   My final objective 
is to be able to easily query a big external table (stored in another database) 
through the - excellent - sqlite interface.   Now I have this terrible 
doubt: will the existing sqlite limitations for big sqlite tables also apply 
to my read-only virtual tables?   Thus... am I currently losing my time 
developing such a virtual table with this objective in mind? Or is there a 
better way to achieve my objective?   Thank you for your help!

Re: [sqlite] Trigger's actions and callbacks

2008-04-02 Thread Vladimir Volkov

If you are trying to use a different connection, you would only see 
changes once the first connection committed its transaction - so don't 
do that.

 sqlite_update_hook() returnes rowID, but I didn't
 find any API to use this value...

You just run a statement along the lines of

select * from dbName.tableName where rowid=?

You need to run this statement on the same connection the hook is 
installed on.

Thanks. But I am experiensing some problems here. When I am using the same
connection (I store it as third parameter to callback registering function

 sqlite3_update_hook(db, Callback, db);

and when trying to access to the db inside callback

 sqlite3_prepare((sqlite3*)data_arg_3, [...])

, an error SQLITE_MISUSE  is returned to me (from sqlite3_prepare() as well
as sqlite3_step() ). And finally I have got a Segmentation Fault from
sqlite3_column_*().
The same with db connection as a global variable, when it is used during
registering callback and inside one.

So I supposed earlier that it is prohibited to use the same connection
inside callback. And a really I used another connection and got nothing.

So the question is - how to use the same connection correctry inside the
callback?

-- 
View this message in context: 
http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16446898.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Trigger's actions and callbacks

2008-04-02 Thread Igor Tandetnik
Vladimir Volkov
[EMAIL PROTECTED] wrote in
message news:[EMAIL PROTECTED]
 sqlite_update_hook() returnes rowID, but I didn't
 find any API to use this value...

 You just run a statement along the lines of

 select * from dbName.tableName where rowid=?

 You need to run this statement on the same connection the hook is
 installed on.

 Thanks. But I am experiensing some problems here. When I am using the
 same connection (I store it as third parameter to callback
 registering function

 sqlite3_update_hook(db, Callback, db);

 and when trying to access to the db inside callback

 sqlite3_prepare((sqlite3*)data_arg_3, [...])

Show how Callback is declared. Did you really name its first parameter 
data_arg_3?

Igor Tandetnik



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Trigger's actions and callbacks

2008-04-02 Thread D. Richard Hipp


 Thanks. But I am experiensing some problems here. When I am using  
 the same
 connection (I store it as third parameter to callback registering  
 function

 sqlite3_update_hook(db, Callback, db);

 and when trying to access to the db inside callback

 sqlite3_prepare((sqlite3*)data_arg_3, [...])

 , an error SQLITE_MISUSE  is returned to me

SQLite is not reentrant through the update hook.


D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Griggs, Donald
Hi, Aladin,

Regarding:  
   Do you know where I can get the files fs.c and example.c you
mention? [ http://www.ddj.com/database/202802959 ] I've been on the FTP
(available from www.ddj.com/code/) but I was not able to locate...



The code appears to be in the December 2007 (0712.zip) file, and not the
0711.zip as one might think.





This email and any attachments have been scanned for known viruses using 
multiple scanners. We believe that this email and any attachments are virus 
free, however the recipient must take full responsibility for virus checking. 
This email message is intended for the named recipient only. It may be 
privileged and/or confidential. If you are not the named recipient of this 
email please notify us immediately and do not copy it or use it for any 
purpose, nor disclose its contents to any other person.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Aladdin Lampé

Thank you. That's exactly the mistake I did :-) Date: Wed, 2 Apr 2008 09:11:44 
-0400 From: [EMAIL PROTECTED] To: sqlite-users@sqlite.org Subject: Re: 
[sqlite] Virtual table used to query big external database  Hi, Aladin,  
Regarding:  Do you know where I can get the files fs.c and example.c you 
mention? [ http://www.ddj.com/database/202802959 ] I've been on the FTP 
(available from www.ddj.com/code/) but I was not able to locate...The 
code appears to be in the December 2007 (0712.zip) file, and not the 0711.zip 
as one might think.  This email and any attachments have been scanned 
for known viruses using multiple scanners. We believe that this email and any 
attachments are virus free, however the recipient must take full responsibility 
for virus checking.  This email message is intended for the named recipient 
only. It may be privileged and/or confidential. If you are not the named 
recipient of this email please notify us immediately and do not copy it or use 
it for any purpose, nor disclose its contents to any other person. 
___ sqlite-users mailing list 
sqlite-users@sqlite.org 
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_
Découvrez les profils Messenger de vos amis !
http://home.services.spaces.live.com/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Mike Owens
Here's a link to the source:

ftp://66.77.27.238/sourcecode/ddj/2007/0712.zip

BTW, I totally missed the new bitvec recently introduced in the latest
version to track dirty pages. This pretty much removes the previous
constraints I mentioned on large databases, reducing memory
consumption to proportional to transaction size (actual dirty pages).
So this would seem to raise the practical limits significantly,
perhaps into the TBs for many operations (e.g. SELECTs).

-- Mike

On Wed, Apr 2, 2008 at 3:57 AM, Aladdin Lampé [EMAIL PROTECTED] wrote:

  Thanks a lot Mike for your detailed answer! I've just read your acticle.
  Do you know where I can get the files fs.c and example.c you mention? 
 I've been on the FTP (available from www.ddj.com/code/) but I was not able to 
 locate any file related to your article :( Could you please send them to me 
 by email if they are no longer available online? (genio570 -AT- hotmail DOT 
 fr).

  It seems like I will be able to further develop the system I described in my 
 previous post with the information you mentioned.

  Another quick question: I planned to develop my own indexing algorithm on 
 the external database side. But do you think I could also consider (as 
 another option) using the CREATE INDEX sqlite command (involving of course 
 a complete scan of the external table's column and then storing the index 
 inside the sqlite file)? What would you recommend me to do?

  In a more general way, I wonder which sqlite SQL commands can involve 
 virtual tables and which cannot or should not (for instance for performance 
 reasons, etc.).

  Thanks again for your help,
  aladdin Date: Tue, 1 Apr 2008 20:17:54 -0500 From: [EMAIL PROTECTED] To: 
 sqlite-users@sqlite.org Subject: Re: [sqlite] Virtual table used to query 
 big external database  The main reason why SQLite's practical limit is in 
 the 10s of GBs as opposed to TBs (theoretical) is due to how it tracks dirty 
 pages. This is described in the Appropriate Uses page 
 (http://www.sqlite.org/whentouse.html) but I'll rehash it here for 
 convenience. SQLite tracks dirty pages with a bitmap which is allocated 
 before each transaction. The size of the bitmap is proportional to the size 
 (not in rows but in pages) of the database (256 bytes for every 1Mb of 
 database), so as the database grows, the amount of memory allocated before 
 each transaction grows. When you get into the GB range, you are starting to 
 allocate in the MB range of dirty page map memory per transaction, which 
 starts to take its toll on performance.  I could be wrong, but from what I 
 know about virtual tables, there is no such correlation between virtual 
 table size and the dirty page bitmap, as SQLite has no idea how big a 
 virtual table is, nor does it manage the data within the vtable. 
 Furthermore, all SQLite really does in a SELECT statement on a vtable is 
 call your code to iterate over it. So really the only performance issue is 
 how long it takes your code to iterate over your vtable. Thus, your table 
 could be in the TB range, and as long as you are fine with iterating over 
 its contents, there is no additional performance issues to speak of. There 
 are ways to implement virtual tables such that you can limit how much of 
 the table is scanned for certain queries, avoiding having to scan the whole 
 thing every time. I wrote an article that touches on this using the match() 
 function. Its available online:  http://www.ddj.com/database/202802959  
 IMO, virtual tables are one of the most powerful and unique features of 
 SQLite. There is a bit of a learning curve, but it's amazing what you can do 
 with them. It sounds like you going to have to iterate over your external 
 table one way or the other. I see no reason why the vtable approach would be 
 any slower than any other approach that iterates over the data.  Having 
 said that, while iterating over a large vtable is not a big deal (as your 
 program will just step through it one row at a time), you need to be careful 
 about getting too fancy with your SQL as you may end up triggering a lot of 
 background IO. For example, if you tack on an ORDER BY which sorts one of 
 the columns of your vtable, SQLite will end up essentially copying the 
 vtable contents into a temporary file and sorting it, which may or may not 
 be a strain on your system depending on how big your table is (e.g. your 
 vtable is 30Gb and your /tmp folder is on a 10Gb partition). So think 
 through what you are doing when going beyond a simple SELECT * from 
 big_vtable.  -- Mike  On Tue, Apr 1, 2008 at 3:12 PM, Aladdin Lampé 
 [EMAIL PROTECTED] wrote:   Hi all!   Very often, when people ask 
 this list why they have trouble managing in sqlite a big table (50 million 
 lines or more than 10 Go), they are told that sqlite is an embedded database 
 and is not meant to be used for very big databases/tables.   I'm 
 currently in the process of designing a specific, read-only, sqlite virtual 
 

[sqlite] sqlite with emacs (OT)

2008-04-02 Thread Wensui Liu
good morning, all,
when i tried to use sqlite in emacs with shell mode, it doesn't work.
is there a interface for sqlite in emacs / xemacs?
thanks.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite with emacs (OT)

2008-04-02 Thread Derrell Lipman
On Wed, Apr 2, 2008 at 10:30 AM, Wensui Liu [EMAIL PROTECTED] wrote:

 good morning, all,
 when i tried to use sqlite in emacs with shell mode, it doesn't work.
 is there a interface for sqlite in emacs / xemacs?


I use sqlite in emacs shell mode all the time.  What problem are you
encountering?  (Note that sqlite's built-in readline history mechanism won't
be available, but shell mode's own history will be.)

Derrell
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_interrupt and transactions

2008-04-02 Thread Igor Sereda
Greetings!

I need to be able to interrupt a long-running query within a transaction. The 
question is: is it possible that changes made previously in this transaction 
will be affected?

Example pseudo-code:
  1. BEGIN IMMEDIATE
  2. INSERT INTO x (x) VALUES ('y');
  3. SELECT long_running_query
  4. *from another thread* interrupt SELECT via progress handler or 
sqlite3_interrupt
  5. // ignore interrupted return code
  6. COMMIT
  7. SELECT x FROM x WHERE x = 'y' (will it be there?)

When I run a simple example as described above, it works - the transaction is 
not ruined by interrupt. On the other hand, this case is not covered in the 
documentation; specs only say that If the interrupted SQL operation is an 
INSERT, UPDATE, or DELETE that is inside an explicit transaction, then the 
entire transaction will be rolled back automatically. 

So, is it safe to assume that If the interrupted SQL operation is a SELECT 
that is inside an explicit transaction, then the transaction is not affected?

Thanks for your help!
Igor
  



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite with emacs (OT)

2008-04-02 Thread Evans, Mark (Tandem)
If you are talking about the sqlite3 shell, add -interactive to the command 
line.

Cheers,
Mark

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Derrell Lipman
 Sent: Wednesday, April 02, 2008 9:36 AM
 To: General Discussion of SQLite Database
 Subject: Re: [sqlite] sqlite with emacs (OT)

 On Wed, Apr 2, 2008 at 10:30 AM, Wensui Liu
 [EMAIL PROTECTED] wrote:

  good morning, all,
  when i tried to use sqlite in emacs with shell mode, it
 doesn't work.
  is there a interface for sqlite in emacs / xemacs?
 

 I use sqlite in emacs shell mode all the time.  What problem
 are you encountering?  (Note that sqlite's built-in readline
 history mechanism won't be available, but shell mode's own
 history will be.)

 Derrell
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] limts change with switch from bit maps to vectors?

2008-04-02 Thread Shane Harrelson
Is the limit of 64 tables in a join changed now that it's using bit
vectors instead of bit maps?  Similar on number of attached databases?

Or were the changes only to the bitmaps used for page tracking?

http://www.sqlite.org/limits.html

-Shane
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Evans, Mark (Tandem)
Hi Ben,

You said:   You will notice
that for certain queries, xBestIndex/xFilter does not get
used. That means that the SQLite engine is going to have to
walk through your entire table, evaluating the conditions on
each field.

I am not aware of this behavior.  Could you cite an example?

I thought xOpen and xFilter always kick off a walk over a
range of virtual table rows.  Prerequisite of xOpen is index
id returned by xBestIndex.

So you can't just walk a virtual table without xBestIndex
having been called, unless I missed a boat somewhere

It is true that xOpen/xFilter/xClose can be called multiple
times for an index returned by xBestIndex.  So if you allocate
any objects in xBestIndex, you can't let go of them in xClose.
Memory leak is unavoidable unless you modify the virtual table
interface as I had to do to pass additional information in the
calls (prepared statement handle).

When I have more time, I'd like to suggest changes to the
virtual table call interface to facilitate resource management
in the VT  module.  This doesn't come up with the FTS
VT modules because they seem to always return a small index
to a static structure.

One other consideration:  If the query or update has to walk a large
range of rows, there's no way for the core to tell the VTM
that it's done accessing a given row as it sweeps the cursor
forward.  You can end up with a huge number of virtual table
rows in memory.

Regards,
Mark



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Ben Harper
 Sent: Tuesday, April 01, 2008 4:53 PM
 To: General Discussion of SQLite Database
 Subject: Re: [sqlite] Virtual table used to query big
 external database

 The only limitation imposed by SQL that I can think of would
 be inefficiencies in its query plan builder. That is the part
 that figures out how to use the indexes available in the
 database in order to execute the SQL query most efficiently.
 So it really depends on what type of SQL queries you are
 going to be running against this huge DB.
 The dangers are easy to evaluate:
 Create a quick-and-dirty dummy virtual table mechanism, and
 respond to the xBestIndex/xFilter functions. You will notice
 that for certain queries, xBestIndex/xFilter does not get
 used. That means that the SQLite engine is going to have to
 walk through your entire table, evaluating the conditions on
 each field. This is obviously what you wish to avoid. As an
 example, I noticed briefly (I did not investigate
 thoroughly) that having an OR condition in a query would
 prevent the indexes from being used. That was some time ago,
 and it was before the rewrite of the SQL VM, so I don't know
 if that still applies. You'll have to investigate your
 potential queries yourself. A simple query such as WHERE
 myvalue  100 should definitely invoke the use of your own indexes.

 Ben


 On Tue, Apr 1, 2008 at 10:12 PM, Aladdin Lampé
 [EMAIL PROTECTED] wrote:
 
  Hi all!
 
  Very often, when people ask this list why they have trouble
 managing in sqlite a big table (50 million lines or more
 than 10 Go), they are told that sqlite is an embedded
 database and is not meant to be used for very big databases/tables.
 
  I'm currently in the process of designing a specific,
 read-only, sqlite virtual table in order to enable sqlite
 to access data stored in an external database which is
 specially designed to handle very big tables.
 
  My final objective is to be able to easily query a big
 external table (stored in another database) through the -
 excellent - sqlite interface.
 
  Now I have this terrible doubt: will the existing sqlite
 limitations for big sqlite tables also apply to my
 read-only virtual tables?
 
  Thus... am I currently losing my time developing such a
 virtual table with this objective in mind? Or is there a
 better way to achieve my objective?
 
  Thank you for your help!
 
  _
  Votre contact a choisi Hotmail, l'e-mail ultra sécurisé.
 Créez un compte gratuitement !
  http://www.windowslive.fr/hotmail/default.asp
  ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] limts change with switch from bit maps to vectors?

2008-04-02 Thread Dan

On Apr 2, 2008, at 11:57 PM, Shane Harrelson wrote:

 Is the limit of 64 tables in a join changed now that it's using bit
 vectors instead of bit maps?  Similar on number of attached  
 databases?

 Or were the changes only to the bitmaps used for page tracking?

Only the dirty-page tracking. The limits on the number of
attached databases and tables in a join are the same as
they always were.

Dan.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Exception running javasqlite on kaffe for arm architecture

2008-04-02 Thread Charlie Hamilton

In case anyone is interested, the cause of the problem was the -fPIC and 
-DPIC compiler/linker options. You need to remove them for the JNI to 
run on an arm target.

Charlie


 Message: 2
 Date: Tue, 01 Apr 2008 14:40:18 -0400
 From: Charlie Hamilton [EMAIL PROTECTED]
 Subject: [sqlite] Exception running javasqlite on kaffe for arm
   architecture
 To: sqlite-users@sqlite.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Hi,
 
 I'm trying to run sqlite using the java wrapper at 
 http://www.ch-werner.de/javasqlite/ on an arm linux target using kaffe
 1.1.7 and jamvm.
 
 It appears that I'm having a problem with the JNI layer. I am able to 
 run $sqlite3 from the command line, creating/editing database files with 
 no problems. When I run it as a java app:
 
 kaffe -jar sqlite.jar data.db
 
 I get an exception:
 kaffe-bin: exception.c:106: vmExcept_setJNIFrame: Assertion `fp != 
 (JNIFrameAddress)0' failed.
 
 Oddly, it fails the first time when it tries to open the database, but 
 the database file is created. the next time it fails when I try to do a 
 select on a table on the database, with the same exception.
 
 I followed the instructions to cross compile sqlite and the java 
 wrappers for our arm target, and don't see anything obvious that might 
 be causing this. Just wondering if anyone has come across this issue before.
 
 Lastly, the versions I built for the x86 target run fine on the x86 
 kaffe and jamvm.
 
 gcc version is 3.3.1
 kernel is Linux version 2.4.20__mvlcee31-omap730_gsm_gprs 
 ([EMAIL PROTECTED]) (gcc version 3.3.1 (MontaVista 3.3.1-7.0.2.0401382 
 2004-10-08)) #1 Thu Nov 29 16:32:50 HKT 2007
 kernel headers are
 
 Thanks,
 Charlie Hamilton
 D2 Technologies
 [EMAIL PROTECTED]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Virtual table used to query big external database

2008-04-02 Thread Mike Owens
On Wed, Apr 2, 2008 at 11:59 AM, Evans, Mark (Tandem) [EMAIL PROTECTED] wrote:

  One other consideration:  If the query or update has to walk a large
  range of rows, there's no way for the core to tell the VTM
  that it's done accessing a given row as it sweeps the cursor
  forward.  You can end up with a huge number of virtual table
  rows in memory.

I was under the impression that the very act of sweeping the cursor
forward via xNext() means that the previous row is no longer needed,
therefore the VT can safely deallocate any resources associated with
the previous row. I would think that a VT need not ever end up with
any old/stale rows in memory, unless of course its particular
implementation called for it (e.g. caching old rows).

-- Mike



  Regards,
  Mark




   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Ben Harper
   Sent: Tuesday, April 01, 2008 4:53 PM
   To: General Discussion of SQLite Database
   Subject: Re: [sqlite] Virtual table used to query big
   external database
  


  The only limitation imposed by SQL that I can think of would
   be inefficiencies in its query plan builder. That is the part
   that figures out how to use the indexes available in the
   database in order to execute the SQL query most efficiently.
   So it really depends on what type of SQL queries you are
   going to be running against this huge DB.
   The dangers are easy to evaluate:
   Create a quick-and-dirty dummy virtual table mechanism, and
   respond to the xBestIndex/xFilter functions. You will notice
   that for certain queries, xBestIndex/xFilter does not get
   used. That means that the SQLite engine is going to have to
   walk through your entire table, evaluating the conditions on
   each field. This is obviously what you wish to avoid. As an
   example, I noticed briefly (I did not investigate
   thoroughly) that having an OR condition in a query would
   prevent the indexes from being used. That was some time ago,
   and it was before the rewrite of the SQL VM, so I don't know
   if that still applies. You'll have to investigate your
   potential queries yourself. A simple query such as WHERE
   myvalue  100 should definitely invoke the use of your own indexes.
  
   Ben
  
  
   On Tue, Apr 1, 2008 at 10:12 PM, Aladdin Lampé
   [EMAIL PROTECTED] wrote:
   
Hi all!
   
Very often, when people ask this list why they have trouble
   managing in sqlite a big table (50 million lines or more
   than 10 Go), they are told that sqlite is an embedded
   database and is not meant to be used for very big databases/tables.
   
I'm currently in the process of designing a specific,
   read-only, sqlite virtual table in order to enable sqlite
   to access data stored in an external database which is
   specially designed to handle very big tables.
   
My final objective is to be able to easily query a big
   external table (stored in another database) through the -
   excellent - sqlite interface.
   
Now I have this terrible doubt: will the existing sqlite
   limitations for big sqlite tables also apply to my
   read-only virtual tables?
   
Thus... am I currently losing my time developing such a
   virtual table with this objective in mind? Or is there a
   better way to achieve my objective?
   
Thank you for your help!
   
_
Votre contact a choisi Hotmail, l'e-mail ultra sécurisé.
   Créez un compte gratuitement !
http://www.windowslive.fr/hotmail/default.asp
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
   
   ___
   sqlite-users mailing list
   sqlite-users@sqlite.org
   http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
  ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Segmentation fault on database with 2.2 Gb

2008-04-02 Thread Hubertus
Hi all,
very strange. Today I tried to open a database I created about half a year ago
(version 3.?) and I get a segmentation fault. I run a current debian unstable
with sqlite3.5.7 and have absolutely no clue what the problem might be! It works
with other databases and it worked with that one as well... I would be very 
glad for some help. At the bottom you find the strace output.

Thanks a lot

Hubertus

execve(/usr/bin/sqlite3, [sqlite3, data.db, 1], [/* 34 vars */]) = 0
brk(0)  = 0x805
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fdf000
access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or directory)
open(/usr/lib/tls/i686/sse2/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No 
such file or directory)
stat64(/usr/lib/tls/i686/sse2/cmov, 0xbf80e510) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/tls/i686/sse2/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such 
file or directory)
stat64(/usr/lib/tls/i686/sse2, 0xbf80e510) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/tls/i686/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such 
file or directory)
stat64(/usr/lib/tls/i686/cmov, 0xbf80e510) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/tls/i686/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/tls/i686, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/tls/sse2/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such 
file or directory)
stat64(/usr/lib/tls/sse2/cmov, 0xbf80e510) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/tls/sse2/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/tls/sse2, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/tls/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/tls/cmov, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/tls/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64(/usr/lib/tls, 0xbf80e510)  = -1 ENOENT (No such file or directory)
open(/usr/lib/i686/sse2/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such 
file or directory)
stat64(/usr/lib/i686/sse2/cmov, 0xbf80e510) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/i686/sse2/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/i686/sse2, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/i686/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/i686/cmov, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open(/usr/lib/i686/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64(/usr/lib/i686, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open(/usr/lib/sse2/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64(/usr/lib/sse2/cmov, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/sse2/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64(/usr/lib/sse2, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/cmov/libsqlite3.so.0, O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64(/usr/lib/cmov, 0xbf80e510) = -1 ENOENT (No such file or directory)
open(/usr/lib/libsqlite3.so.0, O_RDONLY) = 3
read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\0\000..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=356132, ...}) = 0
mmap2(NULL, 355428, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xb7f88000
mmap2(0xb7fde000, 4096, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x56) = 0xb7fde000
close(3)= 0
open(/usr/lib/i686/cmov/libreadline.so.5, O_RDONLY) = -1 ENOENT (No such file 
or directory)
open(/usr/lib/i686/libreadline.so.5, O_RDONLY) = -1 ENOENT (No such file or 
directory)
open(/usr/lib/libreadline.so.5, O_RDONLY) = -1 ENOENT (No such file or 
directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=79936, ...}) = 0
mmap2(NULL, 79936, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f74000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/libreadline.so.5, O_RDONLY) = 3
read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\316..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=196484, ...}) = 0
mmap2(NULL, 199764, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xb7f43000
mmap2(0xb7f6f000, 16384, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c) = 0xb7f6f000
mmap2(0xb7f73000, 3156, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f73000
close(3)= 0
open(/usr/lib/i686/cmov/libpthread.so.0, O_RDONLY) = -1 ENOENT (No such file 
or directory)
open(/usr/lib/i686/libpthread.so.0, O_RDONLY) = -1 ENOENT 

Re: [sqlite] sqlite with emacs (OT)

2008-04-02 Thread Wensui Liu
yes, it works perfect with -interactive.
thank you so much!

On Wed, Apr 2, 2008 at 11:56 AM, Evans, Mark (Tandem) [EMAIL PROTECTED] wrote:
 If you are talking about the sqlite3 shell, add -interactive to the command 
 line.

  Cheers,
  Mark



   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Derrell Lipman
   Sent: Wednesday, April 02, 2008 9:36 AM
   To: General Discussion of SQLite Database
   Subject: Re: [sqlite] sqlite with emacs (OT)
  
   On Wed, Apr 2, 2008 at 10:30 AM, Wensui Liu
   [EMAIL PROTECTED] wrote:
  
good morning, all,
when i tried to use sqlite in emacs with shell mode, it
   doesn't work.
is there a interface for sqlite in emacs / xemacs?
   
  
   I use sqlite in emacs shell mode all the time.  What problem
   are you encountering?  (Note that sqlite's built-in readline
   history mechanism won't be available, but shell mode's own
   history will be.)
  
   Derrell
   ___
   sqlite-users mailing list
   sqlite-users@sqlite.org
   http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
  ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




-- 
===
WenSui Liu
ChoicePoint Precision Marketing
Phone: 678-893-9457
Email : [EMAIL PROTECTED]
Blog : statcompute.spaces.live.com
===
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users