Which way do you think would be faster? 1. Make Body charfield a primary key and call it with {{car.body_id}} (1 query only) OR 2. Let the primary key be an integer by default and call it with {{car.body}} (2 queries) OR 3. Same as 2 but do inner join first with select_related (1 query)
Say there are MANY cars to list, so i query to look for all the cars, say, with a body = 'Sedan' For the first way: The database looks through the whole list of cars trying to match all the characters equaling 'Sedan'. Matching varchars is slower but there's no need to inner join and only 1 query. The second way: The database looks through the whole list of cars trying to match all the integer equalling 1. The database goes through the Body table and find out what the id 1 represents, which is 'Sedan'. Matching integer is fast but this needs 2 queries. The third way: The database inner joins the Car and Body table by the Body integer primary key, then you get 'Sedan' with just 1 query. Only 1 query but you have to do an inner join which is generally thought of as slow, but it's joining by integer which is fast but not sure how fast/slow overall. The car will have other similar properties as Body, like Transmission, Fuel Type, etc, and you have people who searches and queries for cars with specific properties like, a car with 'Auto' transmission and 'Sedan' with 'Unleaded' petrol. So considering this, which of the 3 ways above would be fastest? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---