File: make_partial_indexes.pl

package info (click to toggle)
libchado-perl 1.31-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 44,716 kB
  • sloc: sql: 282,721; xml: 192,553; perl: 25,524; sh: 102; python: 73; makefile: 57
file content (22 lines) | stat: -rwxr-xr-x 566 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl 
use strict;
use warnings;

use DBI;

my $dbh = DBI->connect("dbi:Pg:dbname=gadfly",'','');

my $type = 'chromosome_arm';

my $sth = $dbh->prepare("select feature_id from feature f, cvterm cv
                        where cv.name = ? and cv.cvterm_id=f.type_id");
$sth->execute($type);

while (my $ida = $sth->fetchrow_arrayref) {
  my $id = $$ida[0];
  warn "creating partial index on srcfeature_id $id ...\n";
  $dbh->do("create index featureloc_src_$id on featureloc (fmin,fmax)
            where srcfeature_id = $id");  
}

$dbh->disconnect;