sql - How do you rewrite a query in PostgreSQL 8.3 -


I am quite new to SQL and need some help with a certain task. I have a query that is called by our flex / java code which is included in many tables to get the information. After running on the analysis of an explanation, I have seen that the query takes more than 15 minutes, which is sometimes many times if the site is in heavy traffic. What I'm trying to do is to create a rule or trigger, which sees that the query is called and instead selects the data from the physical view table. I tried to apply a rule for this, but when I was having trouble getting errors while trying to join many tables in the rules, there is a way in it, whether it is a rule, a trigger, Or I have not seen anything, to see if a certain query is executed that I can replace that query from another table? Thanks in advance.

Example of the query:

player_id, player_level, select current_location (player_id) from server_info to player_id (location_id) where current_location = 'central Hub '

Why not just convert the app into a source of physical visual What do you want Are you There is no way to rewrite the complex premises for an unrelated table source - which I know and, if you can do this, then really have to do magic in your Query Planner / Rule system? SQL view s is implemented with a SELECT RULE , but it does not get you from complex-query to physical view. You can get it from TABLE1 , TABLE2 .

There will be a better question on what types are player_id , and location_id are both int and Both have btree index? Is current_location indexed, and is it being used for similarity, regeps or conditions of choice? Are you using the version of Postgresql? Can you attach a expanicle analysis to that query, which is why waiting for big time?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -