Re: [sqlite] [mlist] Re: round documentation

2010-05-28 Thread reseok
Matt Young schrieb: I second that documentation confusion. There is no truncate to integer, though I wish it would. Try this, SELECT CAST(4.5 AS INTEGER), CAST(ROUND(4.5, 0) AS INTEGER) ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Using cache stats to balance transaction size for optimal performance

2010-05-28 Thread Pavel Ivanov
It will retry the EXCLUSIVE lock each time a page that is not in the cache is required by SQLite (a cache-miss). If SQLite doesn't require to read any pages but only adds new pages to the file does it count as cache-miss? Pavel On Fri, May 28, 2010 at 1:41 AM, Dan Kennedy

[sqlite] SQLITE_OMIT_WSD (3.6.23.1)

2010-05-28 Thread Kim, Albert
Hi, We are compiling sqlite 3.6.23.1 with the SQLITE_OMIT_WSD compile time flag turned on. We are using the amalgamation. We found that this didn't completely eliminate the writable static data in our binary, and some investigation led me to this static variable: SQLITE_PRIVATE VdbeOp

Re: [sqlite] SQLITE_OMIT_WSD (3.6.23.1)

2010-05-28 Thread Dan Kennedy
On May 28, 2010, at 1:11 AM, Kim, Albert wrote: Hi, We are compiling sqlite 3.6.23.1 with the SQLITE_OMIT_WSD compile time flag turned on. We are using the amalgamation. We found that this didn't completely eliminate the writable static data in our binary, and some investigation

Re: [sqlite] Using cache stats to balance transaction size for optimal performance

2010-05-28 Thread Dan Kennedy
On May 28, 2010, at 5:42 PM, Pavel Ivanov wrote: It will retry the EXCLUSIVE lock each time a page that is not in the cache is required by SQLite (a cache-miss). If SQLite doesn't require to read any pages but only adds new pages to the file does it count as cache-miss? Yes.

Re: [sqlite] round documentation

2010-05-28 Thread Igor Tandetnik
Igor Tandetnik wrote: Matt Young youngsan...@gmail.com wrote: I second that documentation confusion. There is no truncate to integer, though I wish it would. Somewhat off-topic, but if you want truncation, this would do it: round(x - 0.5) . Actually, cast(x as integer) works better. It

Re: [sqlite] round documentation

2010-05-28 Thread Matt Young
Bingo, I live and learn On 5/28/10, Igor Tandetnik itandet...@mvps.org wrote: Igor Tandetnik wrote: Matt Young youngsan...@gmail.com wrote: I second that documentation confusion. There is no truncate to integer, though I wish it would. Somewhat off-topic, but if you want truncation, this

Re: [sqlite] Aggregate and join query very slow

2010-05-28 Thread Michael Ash
Thank you very much. Both replies pointed to indexes. So I changed the indexes and markedly improved performance from 12 seconds to about 1.5 seconds for the faster variant (using nested SELECTS) and about 2.2 second for the slower variant. Per suggestions, I indexed year and media on the big

Re: [sqlite] Aggregate and join query very slow

2010-05-28 Thread Black, Michael (IS)
You also need to increase your cache size to match the mysql performance pragma cache 10; Michael D. Black Senior Scientist Northrop Grumman Mission Systems From: sqlite-users-boun...@sqlite.org on behalf of Michael Ash Sent: Fri 5/28/2010 9:57 AM To:

Re: [sqlite] Aggregate and join query very slow

2010-05-28 Thread Tim Romano
How many distinct media-types are there? How many distinct facilities do you have? How many rows are typically returned by your FacilityScore subquery? SELECT facilitynumber,SUM(score_rev) AS score FROM release_cl WHERE media3 AND year=2006 GROUP BY facilitynumber Regards Tim Romano

Re: [sqlite] Aggregate and join query very slow

2010-05-28 Thread Simon Slavin
On 28 May 2010, at 3:57pm, Michael Ash wrote: Per suggestions, I indexed year and media on the big table. So I now have separate indexes for the key variable (releasenumber) and for year and for media.Would it make more sense to have a single index for all three, thus: CREATE UNIQUE

[sqlite] No conflict clause in foreign key clause?

2010-05-28 Thread Robert Nickel
I notice that the foreign key clause (http://www.sqlite.org/syntaxdiagrams.html#foreign-key-clause) does not include a conflict clause (http://www.sqlite.org/syntaxdiagrams.html#conflict-clause). I always specify ON CONFLICT ROLLBACK with my other constraints, but what will happen when a foreign

[sqlite] [ODBC] - possible Bug

2010-05-28 Thread Oliver Peters
Hello, configuration - OS- WinXP 32 sqlite- 3.6.23.1 odbc - 0.86 (http://www.ch-werner.de/sqliteodbc/) frontend - OpenOffice.org (3.2. and 3.2.1 RC2 tested) target -- In OpenOffice Base I need a form where a mainform controls the appearance of records in a

Re: [sqlite] [ODBC] - possible Bug

2010-05-28 Thread Simon Slavin
On 28 May 2010, at 6:04pm, Oliver Peters wrote: Despite using the very simple way to create the form (via assistant) I can't connect mainform and subform. Neither mainforms nor subforms are part of SQLite. Your problem is either with ODBC or OpenOffice and you'll probably get better advice

Re: [sqlite] [ODBC] - possible Bug

2010-05-28 Thread Oliver Peters
Simon Slavin slav...@... writes: [...] Neither mainforms nor subforms are part of SQLite. Your problem is either with ODBC or OpenOffice and you'll probably get better advice elsewhere. [...] But Mr. Werner is part of the team (http://www.sqlite.org/crew.html) and so a working ODBC-Driver

[sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Jim Terman
It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by sqlite, but I get the following from the command line: sqlite CREATE TABLE foo (id INTEGER PRIMARY KEY, value TEXT, timestamp DATE);sqlite CREATE TRIGGER IF NOT EXISTS foo_log AFTER INSERT ON foo BEGIN INSERT INTO foo

Re: [sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Igor Tandetnik
Jim Terman jter...@tivo.com wrote: It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by sqlite, but I get the following from the command line: sqlite CREATE TABLE foo (id INTEGER PRIMARY KEY, value TEXT, timestamp DATE);sqlite CREATE TRIGGER IF NOT EXISTS foo_log AFTER

Re: [sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Jim Terman
sqlite 3.3.6. I didn't realize it was so old. Thanks. Igor Tandetnik wrote: Jim Terman jter...@tivo.com wrote: It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by sqlite, but I get the following from the command line: sqlite CREATE TABLE foo (id INTEGER PRIMARY KEY,

[sqlite] Getting a rowid from a view

2010-05-28 Thread Jim Terman
Say I have a table of phone numbers CREATE TABLE phonebook (first_name TEXT, last_name TEXT, phone_number TEXT); I want to sort this by name, so I create a view CREATE VIEW phonebook_order AS SELECT first_name, last_name, phone_number FROM phonebook ORDER BY last_name, first_name; Now on the

Re: [sqlite] Getting a rowid from a view

2010-05-28 Thread Simon Slavin
On 29 May 2010, at 1:19am, Jim Terman wrote: CREATE VIEW phonebook_order AS SELECT first_name, last_name, phone_number FROM phonebook ORDER BY last_name, first_name; Now on the table phonebook I can do a query: SELECT rowid FROM phonebook where last_name = Smith and first_name = John;

Re: [sqlite] Getting a rowid from a view

2010-05-28 Thread Jim Terman
That's good to now about the automatic rowid. I can certainly create a new column in phonebook that shows the row number with id INTEGER PRIMARY KEY AUTOINCREMENT. However, I'd really would like to do the same thing in a view. Simon Slavin wrote: On 29 May 2010, at 1:19am, Jim Terman wrote:

Re: [sqlite] Getting a rowid from a view

2010-05-28 Thread Simon Slavin
On 29 May 2010, at 1:44am, Jim Terman wrote: That's good to now about the automatic rowid. I can certainly create a new column in phonebook that shows the row number with id INTEGER PRIMARY KEY AUTOINCREMENT. However, I'd really would like to do the same thing in a view. When you do your

Re: [sqlite] Getting a rowid from a view

2010-05-28 Thread Jim Terman
I want the 'rowid' of the view. In other words I'd like to now what row John Smith is in the view. I can do it with a view that is ordered by using count(*), but I wondered if there was a better way. Simon Slavin wrote: Or are you asking about the 'rowid' of the view ? I don't know whether

Re: [sqlite] Getting a rowid from a view

2010-05-28 Thread Simon Slavin
On 29 May 2010, at 2:30am, Jim Terman wrote: I want the 'rowid' of the view. In other words I'd like to now what row John Smith is in the view. I can do it with a view that is ordered by using count(*), but I wondered if there was a better way. I believe that a view is just a window into

Re: [sqlite] SQLITE_OMIT_WSD (3.6.23.1)

2010-05-28 Thread Albert Kim
Hi Dan, It doesn't matter that it will never be written to. Since the variable is a non-const static it will get mapped into the WSD portion of memory. There are actually a few other global static variables that are getting placed in the WSD section of memory. Here is a list of non-const