Quote:
Originally Posted by pootle flump
You've replaced one overhead with another whilst also tightly coupling your application and database and introducing the possibility of update anomalies.
|
Ok. Thanks to Pat Phelan's explanation, I now understand what you were trying to convey. I'd appreciate your inputs on querying too ...
Quote:
Originally Posted by Pat Phelan
... You can build a single view that will show what cities a given user can access, use that view in an INNER JOIN to limit the cities returned by any other SELECT statements you need to build, and be done. A tiny fraction of the amount of work, cleaner application code, and a faster running application...
|
Thanks for taking the time to explain Pootle Flump's comment.
I am a developer, and new to db designing. In the last part of your comments (quoted above) you addressed querying.
Currently, this is how the app works -
1. Users inputs a client id and city.
2. The application checks the db for information on the city and retains the following data: idCountry, idState, idCity, Country Name, State Name, City Name.
3. The application then verifies the client id in the database and retrieves the boolean flags in the Access Definition table (using a SELECT and JOIN query on Client and Access Definition table).
4. Then, based on the flags it checks the Access Country, Access State and Access City table with the previously retained data (see 2) with a SELECT query on each (if required).
5. If the client has access to the city data, the application extracts that from the db and outputs it to the user (along with the Country, State and City name from 1).
Based on the suggestions here, I do plan to alter and drop the boolean flags. What would then be the optimal way of querying the db?
(P.S: The db server used is MySQL 5 with innodb engine and I've read that its
performance with Views isn't that great. So it might be better to ignore them altogether.)