Re: AW: [firebird-support] order by takes too long

2020-03-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hi Karol, perfect! I usually say that I hate DBs but the more I gain deep insights I start to like it. Thank you for your help! Matthias liviuslivius liviusliv...@poczta.onet.pl [firebird-support] < firebird-support@yahoogroups.com> schrieb am Mi., 4. März 2020, 19:38: > > > Pseudo inner join

Re: AW: [firebird-support] order by takes too long

2020-03-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hi Karol, Thanks for your reply. Can you outline how I would do a "inner join to pseudo inner join without affecting resultset". Matthias On Wed, Mar 4, 2020 at 10:12 AM liviuslivius liviusliv...@poczta.onet.pl [firebird-support] wrote: > > > Hi > > You can always change inner join to

Re: AW: [firebird-support] order by takes too long

2020-03-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, I tried the sorting inside and outside a minimal view and it actually worked in both cases without non-indexed reads, meaning FAST. By stripping down my complex view it turned out that a "inner join" with another table inside the view killed my performance. I will now try to evaluate if I

Re: [firebird-support] order by takes too long

2020-03-03 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, I already re-calculated the indexes. But as far as I understood is that as soon as the natural keyword is present the indexes are not used at all. The question is when and how decides the generator of the "plan" that it connot use the indexes Matthias On Tue, Mar 3, 2020 at

Re: [firebird-support] order by takes too long

2020-03-03 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, it seems the problem is related to the VIEW. This is what I also figured out so far. Now I read: "If you see a *NATURAL *plan going against a big table, you've found the problem. If you have where clause or JOIN to that table, make sure you have index defined on related fields. If you do

[firebird-support] order by takes too long

2020-03-02 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, I guess this is another beginners question: I have a table with 300`000 entries. Each row has a separate field TIMESTAMP with its creation data. Now, I query the latest 100 hundred using: select first(100) X, Y, TIMESTAMP from MY_TABLE order by TIMESTAMP DESC -- order by takes all the

[firebird-support] Re: order by takes too long

2020-03-02 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, ok, I guess I need to create a DESC index on TIMESTAMP of MY_TABLE. I could verify this speeds it up from 1 minute to 1 second. This works as long as MY_TABLE is a real table. But now MY_TABLE is actually a View. Can I created a index on a view with firebird? BR Matthias On Mon,

[firebird-support] (When to) recalculate statistics ?

2020-02-25 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello Firebird-Group, With our device we recalculate statistics ALWAYS when booting up the system. Now the DB grows bigger this can now take more than 10 minutes and delays the time until we can really work with the system. As it is not a server and we expect the system to be restart from time to

Re: [firebird-support] Bad performance with select first(1) + order by

2020-02-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
] wrote: > >> 04.02.2020 12:47, Matthias Winkler spmm...@gmail.com [firebird-support] >> wrote: >> > But I need to deal with a heap of old code and re-designing >> > it, is not a real option :-) >> >>Still you can use "up

Re: [firebird-support] Bad performance with select first(1) + order by

2020-02-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello SD, YES That kind of thing is what I was looking for, I guess. Thanks On Tue, Feb 4, 2020 at 12:52 PM Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: > 04.02.2020 12:47, Matthias Winkler spmm...@gmail.com [firebird-support] > wrote: > > But I need to deal

Re: [firebird-support] Bad performance with select first(1) + order by

2020-02-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hi SD, no doubt, that might be solved better or more performant. But I need to deal with a heap of old code and re-designing it, is not a real option :-) On Tue, Feb 4, 2020 at 12:45 PM Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: > 04.02.2020 12:42, Matthias Winkler s

Re: [firebird-support] Bad performance with select first(1) + order by

2020-02-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
@gmail.com [firebird-support] wrote: > > > Just create a descending index, > Set > > tir. 4. feb. 2020 kl. 12:36 skrev Matthias Winkler spmm...@gmail.com > [firebird-support] : > >> >> >> Hello, >> >> I am struggling with my DB performance

[firebird-support] Bad performance with select first(1) + order by

2020-02-04 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, I am struggling with my DB performance once more: SELECT FIRST(1) PRIMKEY FROM TABLE_X ORDER BY PRIMKEY DESC The statement is slow once more because of the sorting. I just want to find the entry with the highest primary key. The PRIMKEY is ASC and unique. Is the another way to

[firebird-support] Speedup big table after delete

2020-01-30 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, I have a table with 1´000´000 entries. As a cleanup I now delete all except for the most recent ones. Do I need to do anything else to improve performance fo the table? Rebuilding indices is not possible if the primary key is a autogenernarted int, right? Any other suggestions? BR

Re: [firebird-support] Executing isql without server running

2020-01-29 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
ust be no other connections to that DB and DB must can be > accessed locally in file system. > > *29 січня 2020, 13:01:21, від "Matthias Winkler spmm...@gmail.com > [firebird-support]" >:* > > > Hi, > > I thought there was a way to work on a fdb file with just i

Re: [firebird-support] Executing isql without server running

2020-01-29 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
74a7000) /lib/ld-linux.so.2 (0xb7773000) Another guess? Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] < firebird-support@yahoogroups.com> schrieb am Mi., 29. Jan. 2020, 12:04: > 29.01.2020 12:01, Matthias Winkler spmm...@gmail.com [firebird-support] > wrote: > >

[firebird-support] Executing isql without server running

2020-01-29 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hi, I thought there was a way to work on a fdb file with just isql and without the firebird process running. But I cannot find the syntax anymore. If I just give a path /path/to/db.fdb I still get an error saying "cannot connect to localhost -902" Any ideas? Matthias

Re: [firebird-support] Statement freezes firebird

2020-01-25 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
hoenix.com [firebird-support] < firebird-support@yahoogroups.com> schrieb am Sa., 25. Jan. 2020, 11:27: > 25.01.2020 07:59, Matthias Winkler spmm...@gmail.com [firebird-support] > wrote: > > The major problem is, that with firebird 2.1.3 the query also completes > within 3 secon

Re: [firebird-support] Statement freezes firebird

2020-01-24 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Thanks for all your replies: The major problem is, that with firebird 2.1.3 the query also completes within 3 seconds. Something seems to have changed with the optimizer, execution plan or whatever (~ sorry I dont know the terms here) related to sorting, or double sorting, or sorting within

Re: [firebird-support] Statement freezes firebird

2020-01-24 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
@SD: Is there a way to force limiting the result set before sorting it? On Fri, Jan 24, 2020 at 2:55 PM Dimitry Sibiryakov s...@ibphoenix.com [firebird-support] wrote: > 24.01.2020 14:49, Matthias Winkler spmm...@gmail.com [firebird-support] > wrote: > > The result are just 8 entr

Re: [firebird-support] Statement freezes firebird

2020-01-24 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
rt] wrote: > 24.01.2020 14:29, Matthias Winkler spmm...@gmail.com [firebird-support] > wrote: > > I see the very same issue with firebird 3.0.4. Any ideas? > >You made nested loop on 18000*18000 records with sorting on each > itaretion. It cannot &

Re: [firebird-support] Statement freezes firebird

2020-01-24 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
@Mark: I see the very same issue with firebird 3.0.4. Any ideas? On Fri, Jan 24, 2020 at 1:46 PM Mark Rotteveel m...@lawinegevaar.nl [firebird-support] wrote: > > > On 2020-01-24 13:29, Matthias Winkler spmm...@gmail.com > [firebird-support] wrote: > > Hello, > >

[firebird-support] Statement freezes firebird

2020-01-24 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
Hello, With Firebird 2.1.7 this statement freezes my firebird server completely. Firebird will take 100% CPU. select first(8) ID from TBL_TEST where ID not in (select first(2) ID from TBL_TEST order by ID desc) order by ID desc The used table has about 18`000 entries. If I remove ONE of