Re: [firebird-support] About the current transaction

2012-10-31 Thread Thomas Steinmaurer
Is it possible to have a SELECT which says me if the current transaction ... - Is READ COMMITED or SNAPSHOT - Is READ ONLY or READ WRITE - Is WAIT or NO WAIT ? SELECT * FROM MON$TRANSACTIONS WHERE MON$TRANSACTION_ID = CURRENT_TRANSACTION Regards, Thomas

[firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
Hi, This is really weird. I cannot see why a NATURAL plan is being used instead of my index, I am not doing anything fancy. Using: FB2.5.1 32 bit classic server Query: select t.SalesOrderNo from stk_stocktransaction t where (t.SourceType = 34) and (t.TransactionType = 'EXTCST') and

Re: [firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Thomas Steinmaurer
Hi, This is really weird. I cannot see why a NATURAL plan is being used instead of my index, I am not doing anything fancy. Using: FB2.5.1 32 bit classic server Query: select t.SalesOrderNo from stk_stocktransaction t where (t.SourceType = 34) and (t.TransactionType = 'EXTCST')

RE: [firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
Hi, This is really weird. I cannot see why a NATURAL plan is being used instead of my index, I am not doing anything fancy. Using: FB2.5.1 32 bit classic server Query: select t.SalesOrderNo from stk_stocktransaction t where (t.SourceType = 34) and (t.TransactionType = 'EXTCST')

Re: [firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Thomas Steinmaurer
This is really weird. I cannot see why a NATURAL plan is being used instead of my index, I am not doing anything fancy. Using: FB2.5.1 32 bit classic server Query: select t.SalesOrderNo from stk_stocktransaction t where (t.SourceType = 34) and (t.TransactionType = 'EXTCST')

RE: [firebird-support] Re: Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
select t.SalesOrderNo from stk_stocktransaction t where (t.SourceType = 34) and (t.TransactionType = 'EXTCST') and (t.RefNo = 'I1') Plan is: PLAN (T NATURAL) Yet I have the following index: SourceType, TransactionType, RefNo asc With selectivity: 0.049 There are only two

RE: [firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
Running SET STATISTICS on this particular index Query RDB$INDICES.RDB$STATISTICS for this index No Change: 0.049277592 Also you can generate a histogram of the used values/permutation with: select sourcetype , transactiontype , refno , count(*) from stk_stocktransaction

[firebird-support] Re: Parameterised like query won't use index in the plan

2012-10-31 Thread Svein Erling Tysvær
Now, I wonder if something similar could actually be done internally by Firebird for the general like case? It could some nifty query logic like the above internally, could it not? If like xxx always generated internally a query logic like this: where myfield starting with prefixof :param up

Re: [firebird-support] Re: Parameterised like query won't use index in the plan

2012-10-31 Thread Kjell Rilbe
Den 2012-10-31 10:45 skrev Svein Erling Tysvær såhär: I tried manually LIKE with and without the addition of STARTING WITH and tried what I thought was likely to have worse performance with STARTING WITH - when the parameter starts with a wildcard. With STARTING WITH, my query executed in

Re: [firebird-support] Re: Using NATURAL plan instead of index - why?

2012-10-31 Thread Kjell Rilbe
Maya, Can you extract the table's full DDL and post here? Kjell -- -- Kjell Rilbe DataDIA AB E-post: kj...@datadia.se Telefon: 08-761 06 55 Mobil: 0733-44 24 64

[firebird-support] Re: Parameterised like query won't use index in the plan

2012-10-31 Thread Svein Erling Tysvær
I tried manually LIKE with and without the addition of STARTING WITH and tried what I thought was likely to have worse performance with STARTING WITH - when the parameter starts with a wildcard. With STARTING WITH, my query executed in 5.4 seconds, without it 4.6 seconds. So, in my simple

Re: [firebird-support] Using NATURAL plan instead of index - why?

2012-10-31 Thread Thomas Steinmaurer
Running SET STATISTICS on this particular index Query RDB$INDICES.RDB$STATISTICS for this index No Change: 0.049277592 Also you can generate a histogram of the used values/permutation with: select sourcetype , transactiontype , refno , count(*) from

RE: [firebird-support] Re: Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
Can you extract the table's full DDL and post here? CREATE TABLE STK_STOCKTRANSACTION ( ID INTEGER DEFAULT 0 NOT NULL, TRANSACTIONTYPE VARCHAR(6), STOCKCODEVARCHAR(25), SALESORDERNO VARCHAR(15), UOM

Re: [firebird-support] Re: Using NATURAL plan instead of index - why?

2012-10-31 Thread Thomas Steinmaurer
CREATE TABLE STK_STOCKTRANSACTION ( ID INTEGER DEFAULT 0 NOT NULL, TRANSACTIONTYPE VARCHAR(6), STOCKCODEVARCHAR(25), SALESORDERNO VARCHAR(15), UOM VARCHAR(3), REFNO

Re: [firebird-support] About the current transaction

2012-10-31 Thread W O
Thank you very much Thomas. Greetings. Walter. El 31/10/2012 03:58, Thomas Steinmaurer t...@iblogmanager.com escribió: ** Is it possible to have a SELECT which says me if the current transaction ... - Is READ COMMITED or SNAPSHOT - Is READ ONLY or READ WRITE - Is WAIT or NO WAIT ?

RE: [firebird-support] Re: Using NATURAL plan instead of index - why?

2012-10-31 Thread Maya Opperman
SOURCEID INTEGER, SOURCETYPE VARCHAR(15), You told us, that SOURCETYPE is not a [VAR]CHAR but a numeric type. Ts, ts, ts ... Ahhh, thank you, thank you, thank you I must be going cross-eyed and looked at the one above by mistake - reading

[firebird-support] (unknown)

2012-10-31 Thread Jack Cane
Two problems, perhaps related: Created a database using sql creation script; opened the empty db in FB connection tab and all was well; Opened and closed my development platform to confirm it saw the db, and again all was well; reopened db in FB and received I/O error.Restarted Windows. Again

[firebird-support] sp case statement

2012-10-31 Thread Matchey,Brian
Is there a way to achieve the logic I'm trying to accomplish with the CASE statement in the WHERE clause below? CREATE OR ALTER PROCEDURE GET_DATA ( Input_code char(1) ) RETURNS ( Output_code integer ) as begin FOR SELECT T.Output_code FROM Table T WHERE

Re: [firebird-support] sp case statement

2012-10-31 Thread Alan J Davies
No. You have some errors in the logic and data types. You can try this. You will get one record returned for every record in your table. CREATE OR ALTER PROCEDURE GET_DATA ( Input_code char(1) ) RETURNS ( Output_code char(1) ) /* you have an integer which will fail */ as begin for select