Re: [sqlite] selecting the top 3 in a group

2009-01-07 Thread Robert Citek
Turning the pseudo code into a bash script produced the desired output: for i in $(sqlite3 team.db 'select distinct div from teams ' ) ; do sqlite3 -separator $'\t' team.db ' select div, team, wins from teams where div="'$i'" order by wins+0 desc limit 3 ;' done I am still c

Re: [sqlite] selecting the top 3 in a group

2009-01-07 Thread Robert Citek
That gets me the best team in the first five divisions. I would like the top three teams within each division. Regards, - Robert On Thu, Jan 8, 2009 at 12:19 AM, aditya siram wrote: > Hi Robert, > SQL has a LIMIT keyword. I have used it to take the top 'x' entries of a > large table , so for ex

Re: [sqlite] selecting the top 3 in a group

2009-01-07 Thread aditya siram
Hi Robert, SQL has a LIMIT keyword. I have used it to take the top 'x' entries of a large table , so for example: SELECT * from table LIMIT 20 You should be able to use it in your query like so: select div, team, max(wins) from teams group by div limit 5; -deech On Thu, Jan 8, 2009 at 12:06 AM,

[sqlite] selecting the top 3 in a group

2009-01-07 Thread Robert Citek
How can I construction a SQL query to pick the top three (3) items in a group? I have a list of sports teams which are grouped into divisions, say A, B, C, D, etc. At the end of the season I would like to get a list of the top three teams (those with the most wins) in each division. If I wanted

Re: [sqlite] Big performance regressions since 3.4.0?

2009-01-07 Thread develo...@yahoo.com
Or solve two problems by improving the algorithm for non-indexed GROUP BY queries: http://www.sqlite.org/cvstrac/tktview?tn=1809 D. Richard Hipp wrote: >Version 3.5.3 made a change to the way DISTINCT is processed. >Probably that change is making your particular case much slower. The >change

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Edward J. Yoon
>>> Each NAS_000 ~ N storages have approximately 300,000 >>> files, the average size of file is few MB (not over GB). >>> The broker servers (with SQLite library) are on the >>> NAS > > It's not clear how many broker servers there are. > One per NAS? 80 ~ 100 servers. and generally one per nas, bu

Re: [sqlite] 600ms for simple query: How to optimize it?

2009-01-07 Thread D. Richard Hipp
On Jan 7, 2009, at 6:11 PM, Lukas Haase wrote: > Hello, > > Can somebody tell me why this (simple) query take so much time? This > query does nothing more than querying a table and JOINing two other > tables together. > > SELECT > ti1.topicID AS topicID, > ti2.topic_textID AS parent,

Re: [sqlite] Java Database Access Code Generator

2009-01-07 Thread jose isaias cabrera
Have you thought of D? http://www.digitalmars.com/d/1.0/index.html the code is like java, but with c++ speed and it's a stand alone program. It's free and it has a few sqlite3 libraries: http://www.dsource.org/projects/ddbi and http://www.dprogramming.com/sqlite.php it's so easy, a caveman

[sqlite] Java Database Access Code Generator

2009-01-07 Thread Mark Fraser
Hello, I am looking for suggestions on a simple tool to generate java db access code that works with SQLite. Ideally what I want is something that will take a database schema file with create table statements as input and will generate the java classes necessary to encapsulate basic operations

[sqlite] 600ms for simple query: How to optimize it?

2009-01-07 Thread Lukas Haase
Hello, Can somebody tell me why this (simple) query take so much time? This query does nothing more than querying a table and JOINing two other tables together. SELECT ti1.topicID AS topicID, ti2.topic_textID AS parent, n.level, n.level_order FROM navigation AS n

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Kees Nuyt
On Wed, 7 Jan 2009 11:14:11 +0900, "Edward J. Yoon" wrote in General Discussion of SQLite Database : > Thanks for your reply. > >> That's a lot of files. Or did you mean rows? >> Are you sure? There can be many other reasons. > > There is a lot of files. So, I don't know exactly > why at this ti

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Kees Nuyt
On Wed, 7 Jan 2009 10:17:06 -0800, "Jim Dodgen" wrote in General Discussion of SQLite Database : > I'm a little worried about how long it takes to open one > of 20,000,000 files in a directory on the NAS? I agree. It would require a very cleverly contructed directory tree, and very short (sub)

Re: [sqlite] Fwd: memory usage

2009-01-07 Thread Kees Nuyt
On Wed, 7 Jan 2009 10:25:12 -0800, ed wrote in General Discussion of SQLite Database : >Hello, I did not receive a reply to my question.Does anyone have any >information on this? Apparently not. I am not much of a source hacker, but perhaps you are. You might be able to intercept allocation and

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Carl Lindgren
Edward J. Yoon wrote: >> Is access to *one* of the 20 million different SQLite files getting >> progressively slower? How big is that specific SQLite file? Is that >> the one that is "huge"? I use SQLite over an NAS (at times), and never >> experience any noticeable slowdown. Is access to his NAS

[sqlite] Fwd: memory usage

2009-01-07 Thread ed
Hello, I did not receive a reply to my question.Does anyone have any information on this? thanks, ed -- Forwarded message -- From: ed Date: Tue, Dec 30, 2008 at 10:02 AM Subject: memory usage To: sqlite-users@sqlite.org Hello, My multi-threaded application has various sqlite db

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Jim Dodgen
I'm a little worried about how long it takes to open one of 20,000,000 files in a directory on the NAS? On Wed, Jan 7, 2009 at 6:36 AM, Edward J. Yoon wrote: > > Is access to *one* of the 20 million different SQLite files getting > > progressively slower? How big is that specific SQLite file? Is

Re: [sqlite] Exporting database to CSV file

2009-01-07 Thread Brandon, Nicholas (UK)
. > > Is there a way to do this entirely through php? I would like > to make a query on a table and write the results to a csv > file so that the user can have the option of downloading it. > Has anyone ever done something similar to this? > > Thanks > I believe there is a function like '

Re: [sqlite] Exporting database to CSV file

2009-01-07 Thread Jonathon
Thanks for the replies... Actually, it seems my requirements have changed.. Is there a way to do this entirely through php? I would like to make a query on a table and write the results to a csv file so that the user can have the option of downloading it. Has anyone ever done something similar t

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Edward J. Yoon
> Is access to *one* of the 20 million different SQLite files getting > progressively slower? How big is that specific SQLite file? Is that > the one that is "huge"? I use SQLite over an NAS (at times), and never > experience any noticeable slowdown. Is access to his NAS itself slow, > perhaps not

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread P Kishor
On 1/7/09, Thomas Briggs wrote: >I actually thought the original question was perfectly clear. I > thought the proposed solution (included in the original post) was > perfectly logical too. So what's all the fuss? The confusion, at least for me, arose from the following sentence in the OP

Re: [sqlite] Deleting duplicate records

2009-01-07 Thread Igor Tandetnik
"Craig Smith" wrote in message news:5d97aa0a-73c0-4b2c-83e7-dd7cef798...@macscripter.net > Alexey, thank you very much for your idea to put a CONSTRAINT on the > table in the first place, that is the trick for a long term solution. > Here is how I have put it together: > > CREATE TABLE talks (memb

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread Thomas Briggs
I actually thought the original question was perfectly clear. I thought the proposed solution (included in the original post) was perfectly logical too. So what's all the fuss? On Wed, Jan 7, 2009 at 7:28 AM, P Kishor wrote: > On 1/6/09, Edward J. Yoon wrote: >> Thanks, >> >> In more detai

Re: [sqlite] SQLite with NAS storage

2009-01-07 Thread P Kishor
On 1/6/09, Edward J. Yoon wrote: > Thanks, > > In more detail, SQLite used for user-based applications (20 million is > the size of app-users). and MySQL used for user location (file path on > NAS) addressing. Edward, At least I still don't understand why you have 20 million databases. My sus

Re: [sqlite] Deleting duplicate records

2009-01-07 Thread Alexey Pechnikov
Hello! В сообщении от Wednesday 07 January 2009 08:56:02 Craig Smith написал(а): > CREATE TABLE talks (member_id INTEGER, date DATE, CONSTRAINT   > constraint_ignore_dup UNIQUE (member_id, date) ON CONFLICT IGNORE); > > I believe that I understand this statement, except for the term   > constraint