Re: 2 million queries against a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adam Sanchez <a(dot)sanchez75(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: 2 million queries against a table
Date: 2020-07-15 15:38:57
Message-ID: 3077129.1594827537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Sanchez <a(dot)sanchez75(at)gmail(dot)com> writes:
> I need to run 2 million queries against a three columns table t
> (s,p,o) which size is 10 billions rows. The data type of each column
> is string. The server has 512G RAM, 32 cores and 14T SSD (RAID 0)

> Only two types of queries:

> select s p o from t where s = param
> select s p o from t where o = param

TBH, this is a pretty silly way to use a SQL database. Put
the probe values into a temporary table (in batches, perhaps)
and do a join. The per-row cost of that sort of approach
will be multiple orders of magnitude smaller than a query
per row.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurent FAILLIE 2020-07-15 15:54:03 Re: Clustering solution ?
Previous Message Ron 2020-07-15 15:28:18 Re: 2 million queries against a table