Subject | Re: Sql Query |
---|---|
Author | Svein Erling |
Post date | 2003-11-10T12:06:56Z |
--- In firebird-support@yahoogroups.com, Mahesh Ishwar wrote:
Set
> Thanx for your responses. I tried it with 'not exists' also butaliases>
> 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
> )Most likely, you would want an index on column4.
> {column3 is defined as time stamp}
> Is it something very basic being missed out?
> Any help is apreciable.
Set