I ran into a strange problem today. I added a content query web part to my page, then asked it to filter by a custom content type. I had no item limit applied, since there were only 5 pages or so that use that content type. My scope was set to the whole site collection. Boy, was I surprised when every single page in the site got returned! The pages that used by content type showed up at the top of the results, but then pages that used other content types altogether were returned as well. It seemed as if the web part was flat-out ignoring the content type part of my query.
In another place in the site, I had created an column index on my Content Type column, hoping it would optimize some other queries I was doing. As you might know, applying an index to a column essentially creates a new table in the database where the list items are sorted by that column. Well, apparently the side effect of the index was that when the content query web part performed the query, it was returning my results sorted by the content type, but not filtered by the content type. Once I removed the index from the column, my content query web part returned only the pages that used my content type.
Another day, another lesson learned.