All pastes #206721 Raw Edit

Mine

public text v1 · immutable
#206721 ·published 2006-10-17 15:12 UTC
rendered paste body
dltphotography.co.uk=# explain SELECT *, to_number('0' || picfilename,'999999999') as numeric FROM tblPictures WHERE galleryid='KingwaterDressageWaltonBrampton8thOctober2006' ORDER BY substr(picfilename,0,2), numeric ASC;
                                                   QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
 Sort  (cost=533.11..535.78 rows=1069 width=107)
   Sort Key: substr((picfilename)::text, 0, 2), to_number(('0'::text || (picfilename)::text), '999999999'::text)
   ->  Index Scan using picfilename_num_idx on tblpictures  (cost=0.00..479.33 rows=1069 width=107)
         Index Cond: ((galleryid)::text = 'KingwaterDressageWaltonBrampton8thOctober2006'::text)
(4 rows)