Subject | Re: [firebird-support] Possible to have an index across 2 tables? |
---|---|
Author | tjelvar eriksson |
Post date | 2008-11-04T09:59:36Z |
Hi Maya,
customers -1:n- incidents -1:n- comments,
guess a aggreagated view is as fast as it gets without triggers,
of course with indexed keys, but I recall I had just the same need a
few years ago and the performance was a horror.
updated by trigger upon new or altered record in the comments-table.
Good luck,
//t
4 nov 2008 kl. 08.53 skrev Maya Opperman:
>I need some advice on how to structure my table for speed, but withoutI figure your databas looks like:
>creating a redundant field hopefully.
customers -1:n- incidents -1:n- comments,
guess a aggreagated view is as fast as it gets without triggers,
of course with indexed keys, but I recall I had just the same need a
few years ago and the performance was a horror.
>I need to see the latest communication for a customer. Problem is, theI'd recommend a "lastCommentDate" or something in the incidents-table,
>customer ID is not in the communications table, but is instead linked
>via an incidents table.
updated by trigger upon new or altered record in the comments-table.
Good luck,
//t
4 nov 2008 kl. 08.53 skrev Maya Opperman:
>[Non-text portions of this message have been removed]
> Hi Set,
>
> >I don't quite grasp your structure, so it is difficult to give sound
> advice. How is COMMUNICATIONS and INCIDENT defined, what is their
> >relationship and approximately how many records are there within each
> table and for each customer?
> Just answered in reply to Helen's mail, but in short:
>
>
> customers -1:n- incidents -1:n- comments
>
> Table Records
> Customers 15000 PK ID
> Incidents 150000 PK ID, CustomerID references Customers.ID
> Comms 1500000 PK ID, IncidentID references Incidents.ID
>
> Need to extract max date in Comms per Customer
>
>