Subject Re: [firebird-support] Re: separate table or separate database
Author Marcin Bury
I have similar situation - but less records - these are invoices.

What I did , I added extra field called week_no. this is integer field that
stores year week number in the following format:
yyyyww - I multiply year by 100 and add week number - i.e 200712

Then add an index on this field and searching where week_no = 200712 is
lighting fast

If you don't want any calculations use date field and put date_of_inserting
in before_insert trigger.
this field must have an index!!!

then searching where date_of_inserting between monday_date and sunday_date
is also lighting fast.

HTH

Marcin

PS . In the mean time I did some test - I also have a table that contains
more then milion records. It has a column sort of date_of_inserting

I tested a query 'where date_of_inserting between monday_date and
sunday_date' and got the result of 2833 record with prepare time 15ms and
execute time 16ms...

Indexes..., indexes... - we can't live without them ;-)


----- Original Message -----
From: "Sean" <firebird_tmc@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, July 27, 2007 9:43 PM
Subject: [firebird-support] Re: separate table or separate database


> In my scenario, I am not searching for a particular name. My query is
> to list all names inserted in a specific week. if I split my 10
> million names based on time-range, i.e., one table per week, then I
> only need to search 1~2 tables with much smaller amount of data.
>
>
>
>
> --- In firebird-support@yahoogroups.com, "Martijn Tonies"
> <m.tonies@...> wrote:
>>
>> Now, imagine I have a phonebook with 10 million names, searching for
>> a specific name becomes slower.
>>
>> Now, imagine I have 1 million phonebooks with 10 names each. Why does
>> this make searching for a specific name faster?
>>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>