Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-11-01 Thread Kristoffer Danielsson
Yes!! SQLITE_ENABLE_STAT2 did the trick. I can see that the SQLite library increased some 10 kB after this change. No big deal. Why isn't this flag on by default? > From: kristoffer.daniels...@live.se > To: sqlite-users@sqlite.org > Date: Sun, 1 Nov 2009 17:04:41 +0100 > Subject: Re:

Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-11-01 Thread Kristoffer Danielsson
The parentheses around A is a workaround to avoid the "natural self-join" bug (fixed in 3.6.20+ as far as I know). In this particular case they can be omitted, with no difference. The parenthesis around B+C+D are there to get a valid inner join - B and D do not contain A_ID, but C does.

Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-11-01 Thread Pavel Ivanov
> (B + C + D) have two columns that are present in A, of which only one is > indexed. Could that be the culprit? There's an easy way to check that: just re-write your query so that it contains joins with explicitly pointed condition which columns join should be made on. BTW, why are you putting

Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-10-31 Thread Kristoffer Danielsson
All I know is that SQLite chooses the wrong order when I give it my query at this form: SELECT COUNT(A_ID) FROM (A) NATURAL JOIN (B NATURAL JOIN C NATURAL JOIN D); Where: A = 50,000 rows. B = 2 rows. C = 10,000 rows D = 250,000 rows (B + C + D) have two columns that are

Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-10-30 Thread Simon Slavin
On 30 Oct 2009, at 4:07pm, Kristoffer Danielsson wrote: > "Some database engines like SQL Server decide which table is the > outer table and which table is the inner table" > > > How do I simulate that behavior in SQLite? A misformed SQL statement > from the user results in unacceptable

Re: [sqlite] How to decide which table is the outer table and which table is the inner table?

2009-10-30 Thread Pavel Ivanov
Of course SQLite wasn't changed much in this part since November 2008 but the citation you gave is either wrong or the key words in it are "something like" in phrase "SQlite does something like this". Because SQLite is smart enough to choose smaller table as an outer one and bigger table as an