[sqlite] Re: Question on SQL query optimization with joins

2006-06-14 Thread Igor Tandetnik
Bob Dankert <[EMAIL PROTECTED]> wrote: I have been pondering an issue for a while regarding the separation of query conditions from the join condition and the where condition of the query. All I have been able to find on this matter is general text "use the ON clause for conditions that specify

[sqlite] Question on SQL query optimization with joins

2006-06-14 Thread Bob Dankert
I have been pondering an issue for a while regarding the separation of query conditions from the join condition and the where condition of the query. All I have been able to find on this matter is general text "use the ON clause for conditions that specify how to join tables, and the WHERE clause

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread drh
Eduardo <[EMAIL PROTECTED]> wrote: > At 19:42 14/06/2006, you wrote: > >On Jun 14, 2006, at 16:42 UTC, [EMAIL PROTECTED] wrote: > > > > > Might go a lot faster if you put a "+" in fron of > > > recID. Like this: > > > > > >SELECT * FROM table WHERE +recID IN (...) ORDER BY dateFld > > > >What

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread Eduardo
At 19:42 14/06/2006, you wrote: On Jun 14, 2006, at 16:42 UTC, [EMAIL PROTECTED] wrote: > Might go a lot faster if you put a "+" in fron of > recID. Like this: > >SELECT * FROM table WHERE +recID IN (...) ORDER BY dateFld What magic is this? I checked both lang_expr.html and

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread RohitPatel9999
> SQLite seeks to keep its database file size minimized. > I think that SQLite should by default continue to follow > its current strategy of minimizing file size. But I > am not adverse to adding a PRAGMA that will put the > database into a different "preallocation" mode where > the

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:42 UTC, [EMAIL PROTECTED] wrote: > Might go a lot faster if you put a "+" in fron of > recID. Like this: > >SELECT * FROM table WHERE +recID IN (...) ORDER BY dateFld What magic is this? I checked both lang_expr.html and lang_select.html but can't find any such

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:34 UTC, Eduardo wrote: > >I need to select a large set of records out of a table, sort them by > >one column, and then get just a subset of the sorted list. (For > >example, I might want records 40-60 ordered by date, which is a > >completely different set than records

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread A. Pagaltzis
* Florian Weimer <[EMAIL PROTECTED]> [2006-06-14 18:50]: > * Jay Sprenkle: > > On 6/14/06, RohitPatel <[EMAIL PROTECTED]> wrote: > >> Any solution to that (which does not force end-user of app > >> to manage sqlite file fragments or to defragment disk) ? > > > > A scheduled task or cron job is

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread Florian Weimer
* Jay Sprenkle: > On 6/14/06, RohitPatel <[EMAIL PROTECTED]> wrote: >> >> Any solution to that (which does not force end-user of app to manage sqlite >> file fragments or to defragment disk) ? > > A scheduled task or cron job is trivial to implement and does not > add any extra work for the

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread drh
[EMAIL PROTECTED] wrote: > > SELECT FROM WHERE recID IN () ORDER BY dateFld > Might go a lot faster if you put a "+" in fron of recID. Like this: SELECT * FROM table WHERE +recID IN (...) ORDER BY dateFld Whether or not this is faster depends on what fraction of redIDs actually match

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread Eduardo
At 17:56 14/06/2006, you wrote: I'm finding that ORDER BY is surprisingly slow, and it makes me wonder if I'm doing something wrong. Here's the situation: I need to select a large set of records out of a table, sort them by one column, and then get just a subset of the sorted list. (For

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:16 UTC, Paul Smith wrote: > > SELECT FROM WHERE recID IN ( ORDER BY dateFld > > > >I have a unique index on recID, and an index on dateFld. > > Try making another index on both fields at once. SQLite can only use one > index at a time for each query. Aha, that's

Re: [sqlite] Re: speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:15 UTC, Igor Tandetnik wrote: > > SELECT FROM WHERE recID IN () ORDER BY > > dateFld > > Why not just > > select from order by dateFld; > > ? Because that gets me all records. I only want those in my list of record IDs (which comes from another source, outside the

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:06 UTC, Marco Bambini wrote: > Have you tried to create an indexed? Yes, I mentioned that both recID and dateFld are indexed. > Have you tried to analyze your query with SQLiteManager in order to > see which indexes are used? No, I didn't know about that. Thanks for

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread Paul Smith
At 16:56 14/06/2006, [EMAIL PROTECTED] wrote: I'm finding that ORDER BY is surprisingly slow, and it makes me wonder if I'm doing something wrong. Here's the situation: I need to select a large set of records out of a table, sort them by one column, and then get just a subset of the sorted

[sqlite] Re: speed of ORDER BY clause?

2006-06-14 Thread Igor Tandetnik
joe-QzMH92Wc/[EMAIL PROTECTED] wrote: I'm finding that ORDER BY is surprisingly slow, and it makes me wonder if I'm doing something wrong. Here's the situation: I need to select a large set of records out of a table, sort them by one column, and then get just a subset of the sorted list. (For

Re: [sqlite] speed of ORDER BY clause?

2006-06-14 Thread Marco Bambini
Have you tried to create an indexed? Have you tried to analyze your query with SQLiteManager in order to see which indexes are used? --- Marco Bambini http://www.sqlabs.net http://www.sqlabs.net/blog/ On Jun 14, 2006, at 5:56 PM, [EMAIL PROTECTED] wrote: I'm finding that ORDER BY is

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread Christian Smith
John Stanton uttered: Jay Sprenkle wrote: On 6/14/06, RohitPatel <[EMAIL PROTECTED]> wrote: Any solution to that (which does not force end-user of app to manage sqlite file fragments or to defragment disk) ? A scheduled task or cron job is trivial to implement and does not add any

[sqlite] speed of ORDER BY clause?

2006-06-14 Thread joe
I'm finding that ORDER BY is surprisingly slow, and it makes me wonder if I'm doing something wrong. Here's the situation: I need to select a large set of records out of a table, sort them by one column, and then get just a subset of the sorted list. (For example, I might want records 40-60

Re: [sqlite] How to add a table ?

2006-06-14 Thread Thierry Nauze
Le 14 juin 06 à 18:33, Eduardo a écrit : At 04:56 14/06/2006, you wrote: Hello, I have a database. I want to add a table with columns id integer name varchar addresse varchar ... Which instructions (exactly) I have to give. Check this page

Re: [sqlite] sqlite system table names

2006-06-14 Thread drh
Ralf Junker <[EMAIL PROTECTED]> wrote: > >sqlite_master is it. there are no others. > > How about sqlite_temp_master? Or database.sqlite_master for connected > databases? > OK. Them too. -- D. Richard Hipp <[EMAIL PROTECTED]>

Re: [sqlite] How to add a table ?

2006-06-14 Thread Eduardo
At 04:56 14/06/2006, you wrote: Hello, I have a database. I want to add a table with columns id integer name varchar addresse varchar ... Which instructions (exactly) I have to give. Check this page http://www.sqlite.org/sqlite.html , there are the basic SQL

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread Eduardo
At 16:43 13/06/2006, you wrote: Hi SQLiteUsers After using such application, all used SQLite DB files gets fragmented. How to avoid such fragmentation ? I'm not sure, but vacuum will create a new file, so perhaps this file will be less fragmented then previous one. Or create a new

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread John Stanton
Jay Sprenkle wrote: On 6/14/06, RohitPatel <[EMAIL PROTECTED]> wrote: Any solution to that (which does not force end-user of app to manage sqlite file fragments or to defragment disk) ? A scheduled task or cron job is trivial to implement and does not add any extra work for the end

Re: [sqlite] sqlite system table names

2006-06-14 Thread Ralf Junker
>sqlite_master is it. there are no others. How about sqlite_temp_master? Or database.sqlite_master for connected databases?

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread Jay Sprenkle
On 6/14/06, RohitPatel <[EMAIL PROTECTED]> wrote: Any solution to that (which does not force end-user of app to manage sqlite file fragments or to defragment disk) ? A scheduled task or cron job is trivial to implement and does not add any extra work for the end user. Making Sqlite smart

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread drh
RohitPatel <[EMAIL PROTECTED]> wrote: > Thanks for prompt reply. > > Agreed. SQLite needs zero-configuration. > > But applications using multiple SQLite database files for read and write, > makes those files with many-many fragments in disk. Which definitely > degrades database file

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread RohitPatel9999
Thanks for prompt reply. Agreed. SQLite needs zero-configuration. But applications using multiple SQLite database files for read and write, makes those files with many-many fragments in disk. Which definitely degrades database file read/write performance tremendously. Any solution to that

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread C.Peachment
On Wed, 14 Jun 2006 03:34:04 -0700 (PDT), RohitPatel wrote: >But like some other Databases, if SQLite does provide any way to set >auto-increment for database file by some fixed percentage (say 20%, 40% >etc.) such that everytime database file reaches some threashould size it >automatically

Re: [sqlite] Avoiding Fragmentation of SQLite database file ???

2006-06-14 Thread RohitPatel9999
I know and have used deframentation apps. Thats good. But why to force end-users to defragment their disk. SQLite manages free-space in file very-well (after deleting records). So I also created one template database file with optimum number of records, then deleted records and copied that file