Chris Travers wrote: > John A Meinel wrote: > >> jobapply wrote: >> >> >>> The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER >>> BY x.. >>> >>> How can that be possible? >>> >>> Btw: x and x||t are same ordered >>> >>> phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x >>> || t; >>> QUERY PLAN >>> >>> >> >> >> What types are x and t, I have the feeling "x || t" is actually a >> boolean, so it is only a True/False sort, while ORDER BY x has to do >> some sort of string comparison (which might actually be a locale >> depended comparison, and strcoll can be very slow on some locales) >> >> >> > Am I reading this that wrong? I would think that x || t would mean > "concatenate x and t."
Sorry, I think you are right. I was getting my operators mixed up. > > This is interesting. I never through of writing a multicolumn sort this > way.... I'm also surprised that the sort is faster with a merge operation. Are you using UNICODE as the database format? I'm just wondering if it is doing something funny like casting it to an easier to sort type. > > Best Wishes, > Chris Travers > Metatron Technology Consulting PS> Don't forget to Reply All so that your messages go back to the list.
Description: OpenPGP digital signature