473,657 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Explanation of multiple-column indexes


After some discussion in a separate thread, I've been trying
to get a better understanding of the workings of multiple-column
indexes, and think I'm still missing the point. I understand
indexing (last_name, first_name) in that order if you'd always
be searching last names and only be searching first names in
combination.

What I'm trying to understand is how you would set up these
indexes when you'd always be doing joins with another table.
Suppose you have The Canonical CD Database, and you have a
table "songs" with fields "song_id", "album_id", "song_title ",
and "song_lengt h". Suppose you're often doing searches of
song_title or (for some reason) song_length, and that any time
you'd do such a search, you'd _always_ be joining it to the
"album" table.

It would seem that you'd want at least two multiple-indexes in
the "song" table, one of them including "song_title " and
"album_id", the other including "song_lengt h" and "album_id".
Is this correct? Do you need "song_id" (which would be a
primary key on that table) in there too? What order should
the indexes be in?

If every search for song_title or song_length must be joined
against the album table, it's not clear which should be the
first named column in this index. The experiments I've done
so far have been inconclusive, and I don't think I'm understanding
the process in the first place.

Thanks very much.

Jesse Sheidlower
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1717

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2515
by: David MacQuigg | last post by:
I am writing a chapter for teaching OOP in Python. This chapter is intended as a brief introduction to replace the more complete discussion in Learning Python, 2nd ed, pp. 295-390. I need to explain instance variables. What I'm looking for is the best compromise between brevity and a full explanation. The students are non-CIS technical professionals ( engineers and scientists ). At the point they need this explanation, they have...
2
507
by: MatthewRoberts | last post by:
Howdy All, I have a Windows Service that often stops in its tracks with no exception and no explanation on our QA system. During testing on the development machine, it can handle any workload, and complete with no problems. Even during testing on another test machine, it can handle any workload, and complete with no problems. This behavior has been tested multiple times.
4
1444
by: Phil Thompson | last post by:
Hi I'm very new to JavaScript and just need a bit of an explanation to some code and some ideas of how to edit it to do what I want. The script looks for every <pre> on a page and sets them to style="display:none" it then produces links to show and hide the hidden <pre>s. My problem is that I don't wish it to be a <pre> therefore I have just change the line getElementsByTagName('pre') to getElementsByTagName('form') to which is what I...
1
3339
by: jimfortune | last post by:
From: http://groups-beta.google.com/group/comp.databases.ms-access/msg/769e67e3d0f97a90?hl=en& Errata: 19 solar years = 2939.6018 days should be 19 solar years = 6939.6018 days Easter Function explanation Part II
3
3913
by: BuddyWork | last post by:
Hello, Can some explain how the CLR decides on which assembly will be shared across domains. The explaination in MSDN is not enough. >From MSDN: Indicates that the application will probably have many domains that use the same code, and the loader must share maximal internal resources across application domains.
2
2423
by: Dave Taylor | last post by:
Is there a decent explanation of how menu merging with MDI forms work in VB.NET? I've read through the online help and it still seems that whenever I change menus around or whatever, it breaks everything. VB6, as repetitive as it was to retype menus, was at least consistent. It seems that VB.NET throws menu items wherever it feels like.
4
1827
by: aarklon | last post by:
Hi all, In the article http://en.wikipedia.org/wiki/C_language it is written as follows C has the following important features: 1) A simple core language, with important functionality such as math functions and file handling provided by sets of library routines
20
1403
by: Terrance | last post by:
Hello, I have a question I'm hoping someone can clarify for me. My question regards the declaration of a variable/ array variable. Anyhow, I was wondering if someone can explain the following declaration to me: Dim sendBytes as ( ) = Encoding.ASCII.GetBytes("Is anybody listening...") It looks like type byte is an array. Is this correct? Also, what do the brackets represent? I tried finding some type of explanation but is unsuccessful....
2
3604
by: SmartbizAustralia | last post by:
Hi, This seems to be a neglected bit of info as everyone gets carried away with data binding examples instead. Can simply use the datareader as below: Private Sub PopulateControls1() Dim sSql As String Dim cn As SqlConnection
4
1534
by: dismantle | last post by:
Hi all, this is my 3rd week in studying VB codes and i came across with this codes from a online tutorial about classes. Public Function MiddleInitial() As String MiddleInitial = Left$(middleNameValue, 1) End Function Public Function MiddleInitial(ByVal period As Boolean) As String MiddleInitial = Left$(middleNameValue, 1) & "."
0
8385
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
8303
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
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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...
0
8602
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
7316
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
5632
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
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.