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

2020-03-03 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
03.03.2020 13:23, Matthias Winkler spmm...@gmail.com [firebird-support] wrote: > The question is when and how decides the generator > of the "plan" that it connot use the indexes http://www.ibase.ru/dataaccesspaths/ -- WBR, SD. --

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

2020-03-03 Thread Matthias Winkler spmm...@gmail.com [firebird-support]
@yahoogroups.com [mailto: > firebird-support@yahoogroups.com] > *Gesendet:* Dienstag, 3. März 2020 12:41 > *An:* firebird-support@yahoogroups.com > *Betreff:* Re: [firebird-support] order by takes too long > > > > > > Hello, > > > > it seems the problem is related t

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 h

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

2020-03-02 Thread liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
HiWithout analysis i can only advice to create descending index.Create descending index ixd_mytable__timestamp on mytable(timestamp)Regards,Karol Bieniaszewski null

Re: [firebird-support] ORDER BY too slow

2019-03-21 Thread liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
Hiyes, slowdown is because of sort as engine must sort the table first and then retrieve 10 records.But you can try to speed this up by:SELECT  FIRST 10 SKIP 0  msg.OBJ_GUID AS "MSG_GUID", msg.PRTY, msg.TTL,  pst.OBJ_GUID AS "PST_GUID", pst.MSTB_DTSFROM  (Select * from MSGS m order by m.PRTY) ms

Re: [firebird-support] order by 1, 2 - fb 32990

2018-04-13 Thread acgomes2...@yahoo.com.br [firebird-support]
hi helen... the comma is the less problem... A correct sql: select N.DTEMISSAONOTA as DATA, 'DINHEIRO' as MEIO_PAGAMENTO1, cast('DINHEIRO' as char(10)) as MEIO_PAGAMENTO2, '00' as MEIO_PAGAMENTO, N.VLRTOTALNOTA as VALOR, 0 as AUTENT_01, 0 a

Re: [firebird-support] order by 1, 2 - fb 32990

2018-04-12 Thread Helen Borrie hele...@iinet.net.au [firebird-support]
acgomes2...@yahoo.com.br wrote: > select > A.Codigo > 'DINHEIRO' FORMA_PAGTO > FROM NF A > where A.dataEmissao between '01.01.2018' and '31.01.2018' > and A.Modelo = '55' This should work fine if you place a comma after A.Codigo. It does not make any sense to ORDER BY 2 (nor ORDER BY 1,2)

Re: [firebird-support] Order by :variable in a Stored Procedure

2015-11-03 Thread 'Mark Rotteveel' m...@lawinegevaar.nl [firebird-support]
If you pass a variable into an order by, it will sort on that *value*, and as that is the same for all rows, it is essentially a no-op. You can only do this by either sourcing the order by using a case to specify the column from a parameter, or by dynamically constructing the query, and executin

Re: [firebird-support] Order by

2015-10-07 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
Ok Germán. Just for your advice, we have a forum too, you can ask your questions there in Spanish, Portuguese or English. It is about Firebird, SQL and database design. Usually you receive an answer in the next 24 hours. http://yoforeo.com/firebird21 Greetings. Walter. On Wed, Oct 7, 2015 a

Re: [firebird-support] Order by

2015-10-07 Thread Germán Balbi bal...@yahoo.com [firebird-support]
Walter, conosco tu pagina me encanta, siempre compartiendo información de los problemas cotidianos.En general es el primer lugar a consultar, esta vez no fue así. Te pido disculpas . no volverá a pasar.Para tu tranquilidad al recivir la respuesta Karol, lo primero que hice fue buscar "ORDER BY C

Re: [firebird-support] Order by

2015-10-06 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
Germán, as you can read Spanish, this article can be useful: https://firebird21.wordpress.com/2014/11/20/mostrando-los-resultados-ordenados-por-cualquier-criterio/ Greetings. Walter. On Tue, Oct 6, 2015 at 6:17 PM, Germán Balbi bal...@yahoo.com [firebird-support] wrote: > > > Excellent, very

Re: [firebird-support] Order by

2015-10-06 Thread Germán Balbi bal...@yahoo.com [firebird-support]
Excellent, very simple. Thank Karol El Martes, 6 de octubre, 2015 16:32:08, "liviusliv...@poczta.onet.pl [firebird-support]" escribió:   Hi, ORDER BY CASE USER_NAME WHEN ‘PAUL’ THEN 1 WHEN ‘JOHN’ THEN 2 .. END  regards,Karol Bieniaszewski From: mailto:firebird-support@yahoogroups

Re: [firebird-support] Order by

2015-10-06 Thread liviusliv...@poczta.onet.pl [firebird-support]
Hi, ORDER BY CASE USER_NAME WHEN ‘PAUL’ THEN 1 WHEN ‘JOHN’ THEN 2 .. END regards, Karol Bieniaszewski From: mailto:firebird-support@yahoogroups.com Sent: Tuesday, October 06, 2015 5:20 PM To: Firebird Support Subject: [firebird-support] Order by Hello everyone There is the possibility of

Re: [firebird-support] Order By Not Working Using "WITH" Clause

2015-07-06 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
Hi SET, You have done it this time too Your SQL worked with a small amount of change in below statement     DECLARE VARIABLE FK_BOM2 VARCHAR(2000); Because FK_BOM2 is of GUID type. You are awesome as usual. I would like to say Thank You from bottom of HEART  Thanks Once Again SET... You A

RE: [firebird-support] Order By Not Working Using "WITH" Clause

2015-07-03 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
>Hi All, > >I have below SQL, which is concatenating the ShortCode column data, but >without ordering as per the ORDER_NUMBER column in ABC table in "WITH" clause. > >Please help. > >With TBL_SHORT_CODE (SHORT_CODE, FK_KEY) As  >( >SELECT Distinct(XYZ.SHORT_CODE) As SHORT_CODE, ABC.FK_KEY  >From A

Re: [firebird-support] Order By Not Working Using "WITH" Clause

2015-07-03 Thread 'Mark Rotteveel' m...@lawinegevaar.nl [firebird-support]
Ok, then there are also other grouping or sorting effects involved. Unfortunately there is no way to enforce a specific order. The CTE trick you use is just that: a trick and it doesn't always work. So until Firebird supports a list(... Order by...), there is no way to always get a deterministic

Re: [firebird-support] Order By Not Working Using "WITH" Clause

2015-07-03 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
Even if I don't use Distinct, i don't get expected result. On Friday, 3 July 2015 7:17 PM, "Mark Rotteveel m...@lawinegevaar.nl [firebird-support]" wrote:   On Fri, 3 Jul 2015 12:15:31 + (UTC), "Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]" wrote: > Hi All, > I ha

Re: [firebird-support] Order By Not Working Using "WITH" Clause

2015-07-03 Thread Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
On Fri, 3 Jul 2015 12:15:31 + (UTC), "Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]" wrote: > Hi All, > I have below SQL, which is concatenating the ShortCode column data, but > without ordering as per the ORDER_NUMBER column in ABC table in "WITH" > clause. > Please help. > > With

Re: [firebird-support] order by

2014-04-07 Thread Ann Harrison
On Mon, Apr 7, 2014 at 6:47 AM, checkmail wrote: > > > I've a litte question. Now I can order by the column number, order by 1. > Can I set this information with a variable? > > Dim k as integer = 1; > > Order by :k? > > > You can do the equivalent with an EXECUTE STATEMENT.With the exception

Re: [firebird-support] order by

2014-04-07 Thread Andrea Raimondi
To avoid those cases, I will usually wrap the long and complex expression in an outer select giving it an intuitive column name. It does not work in *all* cases, but it does work in most. A On Mon, Apr 7, 2014 at 3:05 PM, Tim Ward wrote: > > > Thanks. Knowing this reasoning, one can then use o

Re: [firebird-support] order by

2014-04-07 Thread Tim Ward
Thanks. Knowing this reasoning, one can then use one's judgement in comparing this reason against a desire to avoid repeating a long complex expression which could also lead to a maintenance risk. On 07/04/2014 15:02, Andrea Raimondi wrote: I am of this opinion because SQL scripts change and wh

Re: [firebird-support] order by

2014-04-07 Thread Andrea Raimondi
I am of this opinion because SQL scripts change and what is today column number 2 may become column number 14 two days later. This, in turn, leads to potential problems because you think it's ordering by something whereas instead it's ordering by something else. A On Mon, Apr 7, 2014 at 2:58 PM,

Re: [firebird-support] order by

2014-04-07 Thread Tim Ward
On 07/04/2014 12:40, Andrea Raimondi wrote: And anyway, you should never be using an order by number - unless there is really no way around it, in my opinion. When people make statements like that it would be really helpful if they were to say *why* they are of this opinion, otherwise the read

Re: [firebird-support] order by

2014-04-07 Thread Andrea Raimondi
I don't think so. And anyway, you should never be using an order by number - unless there is really no way around it, in my opinion. A On Mon, Apr 7, 2014 at 11:47 AM, checkmail wrote: > > > Hello, > > > > I've a litte question. Now I can order by the column number, order by 1. > Can I set th

RE: [firebird-support] order by with grouping?

2013-01-24 Thread Leyne, Sean
Kelly, > always a great place to get help!! > > here's what i have data wise: > > Tag ID Date > > ABC 11 2012 > DEF 11 2011 > GHJ 11 2010 > HHH 22 2012 > ZZZ 22 2011 > AAA 22 2010 > AAK 33 2012 > AAD 44 2012 > YYY 44

Re: [firebird-support] order by using parameter of stored procedure

2012-03-20 Thread Ann Harrison
On Tue, Mar 20, 2012 at 12:48 PM, Tomasz Tyrakowski < t.tyrakow...@sol-system.pl> wrote: > > How to best implement ORDER BY of a query when the field by which to > > order, is given as stored procedure input parameter? > > If the data set returned by the procedure is not very large, return all >

Re: [firebird-support] order by using parameter of stored procedure

2012-03-20 Thread Tomasz Tyrakowski
> How to best implement ORDER BY of a query when the field by which to > order, is given as stored procedure input parameter? If the data set returned by the procedure is not very large, return all relevant fields from the procedure and use order by in the query selecting from the procedure (it

Re: [firebird-support] order by using parameter of stored procedure

2012-03-19 Thread Mark Rotteveel
On Sun, 18 Mar 2012 22:26:11 +0200, Newbie wrote: > How to best implement ORDER BY of a query when the field by which to > order, is given as stored procedure input parameter? > for example a typical product list where could be ordered by Name, Price > etc fields depending on what user clicks. >

Re: [firebird-support] order by using parameter of stored procedure

2012-03-18 Thread Helen Borrie
At 09:26 AM 19/03/2012, Newbie wrote: >How to best implement ORDER BY of a query when the field by which to >order, is given as stored procedure input parameter? It is not possible to that directly, as ORDER BY is a structural element that is pre-compiled. >for example a typical product list wh