DEV Community

loading...

Discussion on: SQLAlchemy Performance Anti-Patterns and Their Fixes

Collapse
ss153g profile image
ss153g • Edited

Great article! I was searching for if it is faster to search int and string together vs. just string. My use case is at follows: I'm getting brand & product information together however, I need to store brand separately and use it's primary_key as a foreign_key in my products table. Instead of looking up brand by its name, I'm creating an int equivalent of the brand name by calculating the sum of ascii value of each character of the brand. Then when I get a brand, I'm doing a search against the int sum value and brand text. My assumption is that the query will first search int first which will be faster and since ascii sum of the different text values can be the same, the query may have more than one record back and then the query uses the string value to further filter down the table.
I am also getting data from the taxonomy from here: google.com/basepages/producttype/t...