[Bioperl-guts-l] bioperl-live/Bio/DB/GFF/Adaptor/dbi pg.pm, 1.16, 1.17

Scott Cain scain at pub.open-bio.org
Fri Feb 10 09:51:49 EST 2006


Update of /home/repository/bioperl/bioperl-live/Bio/DB/GFF/Adaptor/dbi
In directory pub.open-bio.org:/tmp/cvs-serv21977/Bio/DB/GFF/Adaptor/dbi

Modified Files:
	pg.pm 
Log Message:
sped up case insensitive name searching in postgres


Index: pg.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/DB/GFF/Adaptor/dbi/pg.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** pg.pm	9 Dec 2005 12:17:58 -0000	1.16
--- pg.pm	10 Feb 2006 14:51:47 -0000	1.17
***************
*** 373,376 ****
--- 373,379 ----
  CREATE INDEX fgroup_gname_idx ON fgroup(gname)
  },
+                 fgroup_lower_gname_idx => q{
+ CREATE INDEX fgroup_lower_gname_idx ON fgroup (lower(gname))
+ },
  	   }, # fgroup indexes
  
***************
*** 1097,1108 ****
    my ($class,$name) = @_;
  
!   $name =~ tr/*/%/;
! 
!   #Have to use ILIKE no matter what unfortunately, unless
!   #we add a lower(gname) index to fgroup. Then we could add
!   #a conditional to use this line with wildcard searches and
!   #this without: 'lower(fgroup.gname) = lower(?)" which should
!   #be faster
!   return ("fgroup.gclass=? AND fgroup.gname ILIKE ?",$class,$name);
  }
  
--- 1100,1111 ----
    my ($class,$name) = @_;
  
!   if ($name !~ /\*/) {
!     #allows utilization of an index on lower(gname)
!     return ("fgroup.gclass=? AND lower(fgroup.gname) = lower(?)",$class,$name);
!   }
!   else {
!     $name =~ tr/*/%/;
!     return ("fgroup.gclass=? AND lower(fgroup.gname) LIKE lower(?)",$class,$name);
!   }
  }
  



More information about the Bioperl-guts-l mailing list