[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#761108: debsources: file name / path search



Package: qa.debian.org
Severity: wishlist

We already have all paths in the DB, it would trivial and very useful to
offer file/path-based search functionalities.

The only caveat is query execution team.
Some preliminary micro-benchmarks:

- it is too slow without decent index:

   debsources=> select count(*) from files where path like '%stdio%';
   count
  -------
    9643
  (1 row)

  Time: 7736,861 ms

- but it works pretty decently with trigram indexing:

  debsources=> \d ix_files_path_trgm
        Index "public.ix_files_path_trgm"
   Column |  Type   |          Definition
  --------+---------+------------------------------
   encode | integer | encode(path, 'escape'::text)
  gin, for table "public.files"

  debsources=> select count(*) from files where encode(path, 'escape') like '%stdio%';
   count
  -------
    9643
  (1 row)

  Time: 77,558 ms

  To work, the above requires CREATE EXTENSION 'trgm';


Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader  . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

Attachment: signature.asc
Description: Digital signature


Reply to: