473,738 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

indexes and query optimization

1 New Member
I have web page that users use to specify sort and selection critieria for a query. So there is a "most common" type set of where clauses, but they can change. Every time the query is run, there are where clauses on multiple columns, and joins from some columns to other tables, and then it is sorted by a different column.

I am wondering if I should have a clustered index on this table since there are so many columns used in where clauses. Would it be useful to cluster on the column it is sorted by, or should I just stick with nonclustered indexes?
Thanks
Apr 3 '07 #1
1 1432
iburyak
1,017 Recognized Expert Top Contributor
If you have sort order by different columns, clustered index will not help.
You can have only one clustered index over a table.
But you can still have none clustered indexes over columns you do order by over.
Apr 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1461
by: Alex Glass | last post by:
I am building a query to select contacts and filter by category. I was wondering if anyone could explain why the first select statement takes 950 times as long to execute compared to the second. I'm sure it has something to do with the way the join is processed but I'm still curious what the engine actually does in each case. In my test the first statement executed in 0.03 seconds while the second took Some additional info- In the...
9
1663
by: Igor | last post by:
Is there a way to force optimizer to use indexes without hints? (some server setting or index type...) I'll give an example to clarify : I have a table with fields Customer_Code char(10) not null Invoice_Number int not null and an index on those fields IX_1. there are about 2,000,000 records in the table and those two fields are
12
6199
by: WantedToBeDBA | last post by:
Hi all, db2 => create table emp(empno int not null primary key, \ db2 (cont.) => sex char(1) not null constraint s_check check \ db2 (cont.) => (sex in ('m','f')) \ db2 (cont.) => not enforced \ db2 (cont.) => enable query optimization) DB20000I The SQL command completed successfully. db2 => insert into emp values(1,'m')
2
1873
by: UnixSlaxer | last post by:
Hello, I am using DB2-UDB 8.2, when running the design advisor, It exists tells me that "catalog simulation requires that the server be at level V8.0 or newer", although the DB2 version is 8.2 (with Fixpack 9). When I remove "Materialized Views" from the recommendation and choose only "Indexes", it works. Any suggestions? Command : db2advis -f -d TPCH -t 5 -i c:\q3.sql -m MI -o c:\advise.txt
16
2142
by: romicva | last post by:
I've recently upgraded from 8.1.4 to 8.2.3. System slowed down noticably. Explain shows that indexes are not used. I did reorgs on indexes and tables, collected stats on key fields with detail sample for all indexes with no improvement. Any help would be greatly appretiated. Thank you in advance.
2
3840
by: Keith C. Perry | last post by:
Ok, I've tried a number of things here and I know I'm missing something but at this point my head is spinning (i.e. lack of sleep, too much coffee, etc...) My environment is PG 7.4.3 on Linux with 512Mb of ram and swap. This was just upgraded from 7.4 (just to make sure I'm current). Some of my settings in postgresql are giving fatal errors but I don't think my issue is related to my query problems. I also have a laptop running with...
5
1508
by: Shiraz | last post by:
Is there some manual on how to make indexes? for example: table is create mytable ( a varchar, b varchar, c int, d int
3
2747
by: db2admin | last post by:
hi, our db2advis is broken and i am trying to find other ways to get recommended indexes i tried using command "SET CURRENT EXPLAIN MODE RECOMMEND INDEXES" and it populated ADVISE_INDEXES table. new indexes recommended by this command does not have runstats on it. how can i evaluate new suggested indexes ? do i have to physically create these indexes and then explain my SQL ? can i do it without actually creating suggested indexes ?
2
2609
by: umair.cheema | last post by:
Hi! 1-I read in MS Access help that Indexes are automatically made when we declare a primary key and they are used for fast searching and sorting purpose. But i am still confused that how can i use Indexes,where i can see the in my table? and if i want to make my own indexes, should i use nique attribute column such as vehicle registration number etc? 2-Another thing i wanna ask is; in MS access when we make a query, Is it a view also?...
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.