Subject | Re: [firebird-support] Re: Sql Query |
---|---|
Author | Mahesh Ishwar |
Post date | 2003-11-07T16:13:21Z |
Thanx for your responses. I tried it with 'not exists' also but there was no improvement in the performance.
My table has a field with type timestamp. I made this field as an index. There was a significant improve in the query.
But now I'm facing a different problem. As long as my query(I'd posted eariler and quoted below also) contains the same date(no matter what time I give) it is quite fast. The time I fire a query where the the date range goes beyond a date, it a'ain takes the same time, it was taking before I used the index. Am I missing something very basics?
The index I've defined is like this.
create index a on table1 (column3)
The query is like this
select t1.column1, t1.column2
from table1 t1
where column3 < current_timestamp
and column3 > '<some date>'
and not exists (
select t2.* from table1 t2
where t2.column4=t1.column4
and <some static condition clearly referencing the tables through aliases>
)
{column3 is defined as time stamp}
Is it something very basic being missed out?
Any help is apreciable.
Thanx once a'ain.
Mahesh.
Helen Borrie <helebor@...> wrote:
At 12:40 PM 5/11/2003 +0000, Svein wrote:
select t1.column1, t1.column2
from table1 t1
where <some static condition>
and not exists (
select t2.* from table1 t2
where t2.column3=t1.column3
and <some static condition clearly referencing the tables
through aliases>
)
heLen
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[Non-text portions of this message have been removed]
My table has a field with type timestamp. I made this field as an index. There was a significant improve in the query.
But now I'm facing a different problem. As long as my query(I'd posted eariler and quoted below also) contains the same date(no matter what time I give) it is quite fast. The time I fire a query where the the date range goes beyond a date, it a'ain takes the same time, it was taking before I used the index. Am I missing something very basics?
The index I've defined is like this.
create index a on table1 (column3)
The query is like this
select t1.column1, t1.column2
from table1 t1
where column3 < current_timestamp
and column3 > '<some date>'
and not exists (
select t2.* from table1 t2
where t2.column4=t1.column4
and <some static condition clearly referencing the tables through aliases>
)
{column3 is defined as time stamp}
Is it something very basic being missed out?
Any help is apreciable.
Thanx once a'ain.
Mahesh.
Helen Borrie <helebor@...> wrote:
At 12:40 PM 5/11/2003 +0000, Svein wrote:
>Mahesh,It won't work, because the aliasing is wrong.
>do as Milan advices you and use not exists. Also, alias your table, e.
>g.
>
>select column1, column2
>from table1 t1
>where <some static condition>
>and not exists (
> select * from table1 t2
> where t2.column3=t1.column3
> and <some static condition clearly referencing the the tables
>through aliases>
>)
>
>If this still does not work (it ought to work),
select t1.column1, t1.column2
from table1 t1
where <some static condition>
and not exists (
select t2.* from table1 t2
where t2.column3=t1.column3
and <some static condition clearly referencing the tables
through aliases>
)
heLen
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[Non-text portions of this message have been removed]