From b0de423b385b0188b453ca8950553a0a085a3308 Mon Sep 17 00:00:00 2001 From: John Ricklefs Date: Thu, 24 Sep 2015 21:04:45 -0400 Subject: [PATCH] MAINT: Add indexes to company_symbol/fuzzy_symbol. Reduces AssetFinder.lookup_symbol call times dramatically: With fuzzy=True: 2.32ms per call -> 391 micros With fuzzy=False: 2.35ms -> 451 microseconds --- zipline/assets/asset_writer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipline/assets/asset_writer.py b/zipline/assets/asset_writer.py index c11142e7..a4da5aa1 100644 --- a/zipline/assets/asset_writer.py +++ b/zipline/assets/asset_writer.py @@ -299,9 +299,9 @@ class AssetDBWriter(with_metaclass(ABCMeta)): primary_key=constraints, ), sa.Column('symbol', sa.Text), - sa.Column('company_symbol', sa.Text), + sa.Column('company_symbol', sa.Text, index=True), sa.Column('share_class_symbol', sa.Text), - sa.Column('fuzzy_symbol', sa.Text), + sa.Column('fuzzy_symbol', sa.Text, index=True), sa.Column('asset_name', sa.Text), sa.Column('start_date', sa.Integer, default=0), sa.Column('end_date', sa.Integer),