Re: [firebird-support] How to drop a view only if it exists?

2012-04-11 Thread unordained
-- Original Message --- From: "kokok_kokok" > Using FB 2.5, how can I drop a view only if it exists? > There is something like DROP VIEW IF EXISTS..? --- End of Original Message --- AFAIK, no such syntax. But if you're just looking for something you can generate & throw

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread unordained
-- Original Message --- From: Dmitry Yemanov > This is known as a nested loop join. And "restart from the root" costs > just a couple of page reads that are likely to be satisfied using the > cache. Not something really wasteful. > 2) Streams are read in the index order that allo

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread unordained
-- Original Message --- From: Ann Harrison > And what part of relational theory allows partial matches on keys. > Ann --- End of Original Message --- H. Codd might disagree with the incomplete normalization of his base tables, but relational theory allows for set-joi

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread Ann Harrison
Dmitry, > As expected, it does use the index. > > > And if this test does use the index, then you'll need > > a test with ddl and possibly data from the original author. > > This is what I'm asking for :-) > Right. And perhaps the author can think about the differences between the case that app

[firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread Dmitry Yemanov
Ann, > Way back in the message chain was an example. I remember the example, but IIRC there was no DDL provided. And I recall that the FB version wasn't specified either. My crystal ball tends to fail in such unclear conditions. > create table core (coreName varchar(30), coreCode char (2)); >

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread Ann Harrison
Dmitry, > Still, this doesn't explain why I do see it sometimes using an index to > > support a starts-with join, and he doesn't. > > I can hardly guess without a test case. > > Way back in the message chain was an example. If I understood it correctly, it was something like this: create tabl

[firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread Dmitry Yemanov
11.04.2012 19:09, unordained wrote: > a) for every row in A (regardless of order), do a PK lookup in B [which, > ignoring index-caching, or some implementation tweak to remember where > in the > index you "last were" as a best-guess for the next lookup, is wasteful, > as it would restart from the

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread unordained
-- Original Message --- From: Dmitry Yemanov > > select 1 from bt_dchronexpl inner join bt_ref on bt_ref.file_num = > > bt_dchronexpl.filenumber; > > --> PLAN JOIN (BT_DCHRONEXPL NATURAL, BT_REF INDEX (IX_BT_REF_FILE_NUM_ASC)) > > -- so it CAN use an index, but why not both? just t

Re: AW: [firebird-support] select column

2012-04-11 Thread Mark Rotteveel
On 11-4-2012 14:48, Olaf Kluge wrote: > Hello again, > we have some workstations. Every ws need to show some fields of an table. > Now I thought, I can configure that with the numbers of the column. I also > could write down the column-Names in a configuration table, but sql > statements should be

RE: [firebird-support] select column

2012-04-11 Thread Svein Erling Tysvær
>we have some workstations. Every ws need to show some fields of an table. >Now I thought, I can configure that with the numbers of the column. I also >could write >down the column-Names in a configuration table, but sql statements should be >slower. No need for a configuration table, Olaf, you

[firebird-support] Re: select column

2012-04-11 Thread kokok_kokok
No, it is not possible. Column number is only allowed in ORDER clause. In any case, using column names in SQL statement practically do not affect to the performance in comparison to the time to retrieve the data. --- In firebird-support@yahoogroups.com, "Olaf Kluge" wrote: > > Hello again, >

[firebird-support] How to drop a view only if it exists?

2012-04-11 Thread kokok_kokok
Using FB 2.5, how can I drop a view only if it exists? There is something like DROP VIEW IF EXISTS..? Thank you

AW: [firebird-support] select column

2012-04-11 Thread Olaf Kluge
Hello again, we have some workstations. Every ws need to show some fields of an table. Now I thought, I can configure that with the numbers of the column. I also could write down the column-Names in a configuration table, but sql statements should be slower. Thanks for helping. Olaf

[firebird-support] Re: No index used for join on 'starting with'

2012-04-11 Thread Dmitry Yemanov
11.04.2012 1:49, unordained wrote: > select 1 from bt_dchronexpl inner join bt_ref on bt_ref.file_num = > bt_dchronexpl.filenumber; > --> PLAN JOIN (BT_DCHRONEXPL NATURAL, BT_REF INDEX (IX_BT_REF_FILE_NUM_ASC)) > -- so it CAN use an index, but why not both? just the size imbalance? It's impossibl