You can make it a stored procedure in SQL server or at least use <cfqueryparam> tag. How often does the category data change and how recent results do you need? If it doesn't need to be the newest result set consider caching the query data (you may even run a process every so often to populate a special table in your database that contains the results of this query - this is what I do in such situations and it works great).

TK
  ----- Original Message -----
  From: admin
  To: CF-Talk
  Sent: Sunday, October 26, 2003 4:38 PM
  Subject: cfquery performance suggestions

  I'm using the following query to find all the catagories in a table that start with a certain letter :-

  SELECT distinct CATEGORY
  FROM dbo.mainfile
  where CATEGORY like 'P%'
  order by CATEGORY ASC

  I have an index based on Category but it runs slow (it's a v. large table - and it't can't be redesigned). Any suggestions for a better query to get the results ? - btw I'm very much a SQL novice

  Cheers

  Richard


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to