mysql - Theoretically, Is this SQL query too big to serve quickly under load? -


I have a SQL query that can easily return 70,000 lines of relational database table (with some joining in ). The total size of this result is about 20MB. The total size of the table is approximately 10 million rows.

I am lacking in perspective, so I am thinking that a query of this size is able to serve quickly on a few hundred requests per second on a web page? Apart from this, it is not a readable table: an adequate number of updates / removal (reads 3: 1 and 10: 1 reads / write ratio based on year)

I know that I need it Indexes etc. I am wondering if a database server (with Ram's 4 GB and a modern quad core CPU) can theoretically work out to get awesome performance without getting it out of the CPU or disc IO?

How do you actually look at your questions, you have not provided much background to it,

   

   

 To create  to create foo_id as selectable_series (1,10000000), create the table foo, repeat as filler ('A', 80); Create foo (foo_id) unique index on Foo_foo_id; Vacuum Fu analysis;   

This table is 1400MB total, including the index, so it fits perfectly into my OS cache, but PostgreSQL does not share buffers.

70000 lines sorted by an index to create a custom script:

  \ setrandom key 1 9000000 SELECT * FROM Foo WHERE foo_id & gt; : Foo_id LIMIT 70000 by key order;   

Here are the results of running a benchmark on my 4-core desktop computer (AMD Phenom II X4 955) for 1 minute:

 % pgbench - Jammu 4-C4-T60-N-Script PDB Transaction Type: Custom Query Scaling factor: 1 Query Mode: General Number of Clients: 4 Number of Threads: 4 Duration: 60 S Actual Number of Transactions Transaction: 3922 TPS = 65.309954 (with installed connection) tps = 65.316916 (installed Except for the connection)   

Note that here clients (PBBs) and servers are on the same physical machine, they will be different in reality, hence playing things like network overhead and throughput Come on.

This naïve configuration is much less than 65 * "few hundred requests per second", so you will need too many more powerful servers to control this type of workload . Replication with multiple slaves is an option.

To get a more realistic result, you should zoom the PGNn script and test data to match your workload.

Comments