-探讨:在数据量稍大(几十万条级别)的情况下,联表查询/子查询/用PHP逐步分析结果多次单表查询的优劣与选择
求助-探讨:在数据量稍大(几十万条级别)的情况下,联表查询/子查询/用PHP逐步分析结果多次单表查询的优劣与选择
先说说我现在这个项目的情况
主表40W条记录,大部分与之关联的查询都会比较慢(3秒以上).主键索引.
如果有用到子查询,执行甚至会超时(30秒),或者长达10多秒.
现在我用PHP将每一步查询结果分析,拼装成字符串在用in来查询.目前是快多了
举例子:查询某人关注的人发布的微博(假设主表是微博表). 我就先把某人关注的人查出来,uid拼成字符串,然后查微博表uid in (关注的人字符串) 这样子.
但是还是担心会不会因为其他问题比如严重增加PHP的负荷等等.
现在网站还没做推广用户很少所以还不清楚高并发量和访问数下的情况. 先来问问
各位的网站用联表查或者子查询的多吗? 有没有像我这样用的?
请不吝赐教

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.
