简体   繁体   English

具有多个leftjoin的Mysql

[英]Mysql with multiple leftjoin

Hello I am working in web like this , with this structure 你好,我正在这样的网络工作,这种结构

ALL Matchs Packets{
                    Soccer{
                               France{
                                     Liga A:{
                                             Team A vs Team B{
                                                Bettype A{}
                                                Bettype V{}
                                                Bettype AA{}
                                                Bettype DD{}
                                              }
                                             Team C vs Team D{
....
                                              }   
                                             Team E vs Team F{
....
                                              }      
                                            }
                                     Liga B:{...}                                       
                                     Liga C:{...}
                                     }
                               Spain{
                                     Liga A:
                                     Liga B:
                                     Liga C:
                                     }
                               England{
                                     Liga A:
                                     Liga B:
                                     Liga C:
                                     }
                     },
                     Basket{
                     ...
                     ...
                     }

                   }

I have a main table which contains the details of match,Id_match, Sport,Country, League , Team A, Team B etc. Additionally I have a table for each bettype and contain id_match and other specific data. 我有一个主表,其中包含匹配,Id_match,运动,国家,联赛,A队,B队等的详细信息。此外,我有一个表格,每个bettype和包含id_match和其他特定数据。 I am working with 50+ tables, my web is in php and the database is mysql. 我正在使用50多个表,我的网站是php,数据库是mysql。 Then I make a consult with leftjoin, per each bettype(all leftjoin in 1 consult), and is linked with id_event, the result of my consult return json, and in my html5 I use angularjs for show. 然后我根据每个bettype(在1个咨询中的所有leftjoin)与leftjoin进行咨询,并且与id_event链接,我的咨询返回json的结果,并且在我的html5中,我使用angularjs进行显示。 Some matches have data for all tables, but other show null in some bettypes, that is okay, because each bettype is specific. 有些匹配包含所有表的数据,但其他匹配在某些bettypes中显示为null,这是可以的,因为每个bettype都是特定的。 I am using Angularjs then I need call to database only one time, because I can filter, hide, group, etc; 我正在使用Angularjs然后我只需要调用一次数据库,因为我可以过滤,隐藏,分组等; on the client side 在客户端

my fear is the optimization, I want to know if a consultation like this is fine, because, imagine doing this for 300 games and 60 tables with types of bets. 我担心的是优化,我想知道这样的咨询是否合适,因为,想象这样做300场比赛和60桌有投注类型。

I think in create a menu to filter the Sport->Country->league and only make the consult for this specific group, to do it, I only used my main table(only 1 table), but my question is, if many people call multiple times to the database,will occur the same wear? 我想创建一个菜单来过滤Sport-> Country-> league并且只为这个特定的组进行咨询,为了做到这一点,我只使用了我的主表(只有1个表),但我的问题是,如果很多人多次调用数据库,会发生同样的磨损吗? or this is the solution? 或者这是解决方案?

Since visitor specific filtering will be on the client side, all visitors will get the same full dataset. 由于访问者特定的过滤将在客户端,所有访问者将获得相同的完整数据集。 The json file can be cached and updated eg every minute. json文件可以缓存和更新,例如每分钟。 The load on the database will be independent of the number of visitors. 数据库上的负载将与访问者数量无关。

All data that needs joining but is rarely updated can be cached in a single table. 需要加入但很少更新的所有数据都可以缓存在单个表中。 Updated eg daily. 每日更新。 The queries will be less complex and faster. 查询将不那么复杂和快速。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM