Monday, March 12, 2012

indexing

I am running SQL 2000 and Crystal Reports ASP.
I have two tables called customer and invoice. There are
100000 customers and 7200000 invoices.
Here are the fields:
customer
- id ...1 to 100000
- custno ...1 to 100000
- name
- address1
- address2
- postcode
invoices
- id ...1 to 7200000
- custno ...random numbers below 100000
- inv_type
- amount
- invdate
The emphasis here is, if I type in a customer number then
based on the customer numbers that match in the invoices
table invoices will appear.
I need to index both tables for quickness. I am new to
indexing, please help me!!! There are options for
clustered etc... and I do not know what to do. If I try
entering a customer number in Crystal Reports is takes
around 10 seconds to list around 20 invoices - this should
be instantaneous as it is causing my .asp web application
to time out.
Thanks,
skc
Hi
Posting your DDL (Create table statements) is better than pseudo code!
I indexes can be created through enterprise manager using the buttons on the
table designer dialog. Hopefully you are maintaining your code in a source
code control system, therefore writing SQL directly.
For Create Index statements see Books Online or at
http://msdn.microsoft.com/library/de...asp?frame=true
If you wish to use SQL to do this.
If you have not created primary keys then look at the ALTER table statement
http://msdn.microsoft.com/library/de...sp?frame=true.
This statement can also be used to create a foreign key from the custno
column in the invoices table to the custno column in customers.
HTH
John
"skc" <anonymous@.discussions.microsoft.com> wrote in message
news:1e35501c45506$83d510c0$a401280a@.phx.gbl...
> I am running SQL 2000 and Crystal Reports ASP.
> I have two tables called customer and invoice. There are
> 100000 customers and 7200000 invoices.
> Here are the fields:
> customer
> - id ...1 to 100000
> - custno ...1 to 100000
> - name
> - address1
> - address2
> - postcode
> invoices
> - id ...1 to 7200000
> - custno ...random numbers below 100000
> - inv_type
> - amount
> - invdate
> The emphasis here is, if I type in a customer number then
> based on the customer numbers that match in the invoices
> table invoices will appear.
> I need to index both tables for quickness. I am new to
> indexing, please help me!!! There are options for
> clustered etc... and I do not know what to do. If I try
> entering a customer number in Crystal Reports is takes
> around 10 seconds to list around 20 invoices - this should
> be instantaneous as it is causing my .asp web application
> to time out.
> Thanks,
> skc

No comments:

Post a Comment