indexing on facts?

From: Chuang Liu <liu_nsk_at_yahoo.com.cn>
Date: Thu 02 Dec 2004 06:47:00 PM GMT
Message-ID: <20041202184700.27510.qmail@web15213.mail.bjs.yahoo.com>
Hi there:
I build a large set of facts about network link
between machines in internet, and want to query a
network link with particular bandwidth. Because the
performance of my implementation is very bad, can any
one help to take a look at my solution, please? Any
suggestion is appreciated.

The facts is in the format of
   band(bandwidth, host1, host2).
For example: ( 500, 1, 2) means the bandwidth between
host 1 and host 2 is 500.

I build a query for network link with bandwidth bigger
than N defined as
  find(H1, H2, T) :-
    [H1, H2] :: [ 1..300],
    nconnect(H1, H2, T),
    indomain(H1),
    indomain(H2).

  nconnect(H1, H2, T) :-
    nonvar(T),
    band(B, H1, H2),
    B #>= T.

When I submit a query, I notice every fact is checked,
is there a way to improve it? For example, using B #>=
T and a kind of index on B of fact (B, Host1, Host2)
to filter facts with bandwidth less than T without
checking them one by one?

Thanks

Chuang

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Received on Thu Dec 02 19:06:32 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT