Subject | Re: [firebird-support] Re: FB 2.1.1 slow performance with subselect |
---|---|
Author | Fidel Viegas |
Post date | 2009-02-09T21:30:18Z |
On Mon, Feb 9, 2009 at 9:20 PM, eddressel <eddressel@...> wrote:
used Common Table Expressions (CTEs for short).
at the end is a join between the CTE "temp_order" and the original
table "online_order".
Have a look at the Release Notes of Firebird 2.1+. This was introduced
in Firebird 2.1.
Fidel.
> Wanting to brush up on my SQL.... where do I find help on the newHave a look in the Release Notes. In the example given by Svein, he
> features in 2.x? Maybe these are not 2.x issues... I'm looking at your
> SQL, and it's well over my head. If there's a better place to answer
> these questions, please let me know.
used Common Table Expressions (CTEs for short).
> Specific questions:x is an alias of table online_order, temp_order is the CTE. The select
>
>> with temp_order(order_id) as
>
> that creates a temp table, correct? It's only available inside the
> current transaction, correct?
>
>> and exists(select null from online_order k2
>> where k2.order_date > 01.01.2009'
>> and k2.customer = 16244
>> and k2.rdb$db_key > k.rdb$db_key))
>
> If I was writing this I would have probably added 'select first 1...':
> would that make sense?
>
>> select x.* from online_order x
>> join temp_order t on x.order_id = t.order_id
>> order by x.order_id
>
> I thought it created a temp order, what is x.*?
at the end is a join between the CTE "temp_order" and the original
table "online_order".
Have a look at the Release Notes of Firebird 2.1+. This was introduced
in Firebird 2.1.
Fidel.