Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Databases General > Re: One example...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 3196 of 3295
Post > Topic >>

Re: One example of a slow query.

by Thomas Kellerer <YQDHXVLMUBXG@[EMAIL PROTECTED] > Jun 25, 2008 at 02:16 PM

Arved Sandstrom, 25.06.2008 13:55:
> How common is the latter implementation? MySQL evidently does this, so
that 
> if you had an index on (col1,col2,col3), queries on (col1), (col1,col2)
and 
> (col1,col2,col3) all use the index, but a query on (col2,col3), for
example, 
> does not. What is this incomplete use of multicolumn indexes called, 
> exactly? 

I think that this is related to the fact that most of the time the index
is implemented as a B-Tree index. And technically it is not possible to
access the "second level" directly without finding the "first level".

> As I understand it, it wouldn't be totally useless to have only the
separate 
> indexes for the three columns, namely (col1), (col2), and (col3), as the

> DBMS might use index combination (as does PostgreSQL 8.1 and up). Or
perhaps 
> even better, have the multicolumn index and one or more single-column 
> indexes, depending on what you anticipate the most common queries to be.

Yes and no. Keep in mind that each index will add an overhead when
updating, deleting or inserting rows. So if you have a lot of indexes,
your update performance may degrade. The "art" is finding the proper
balance between the two requirements (fast reads and fast writes)

Postgres does a indeed good job in "re-using" indexes. For e.g. Oracle
something similar could be achieved using bitmap indexes (but they have
higher update costs and are not always feasible)

Thomas
 




 9 Posts in Topic:
One example of a slow query.
"David Cressey"  2008-06-24 18:18:08 
Re: One example of a slow query.
David Segall <david@[E  2008-06-25 09:13:38 
Re: One example of a slow query.
"Roy Hann" <  2008-06-25 11:12:55 
Re: One example of a slow query.
"Arved Sandstrom&quo  2008-06-25 11:55:34 
Re: One example of a slow query.
Thomas Kellerer <YQDHX  2008-06-25 14:16:23 
Re: One example of a slow query.
"David Cressey"  2008-06-25 14:13:42 
Re: One example of a slow query.
"David Cressey"  2008-06-25 14:10:37 
Re: One example of a slow query.
Ed Prochak <edprochak@  2008-06-25 05:09:24 
Re: One example of a slow query.
Ed Prochak <edprochak@  2008-06-25 05:16:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 9:56:54 CST 2008.