I am having the table with 1 million rows.
I know there can be multiple "YanChengCHEOK". But in certain situation, I will
be only interested in 1 "YanChengCHEOK".
I try to perform SELECT query.
SemiconductorInspection=# SELECT measurement_type_id FROM measurement_type
WHERE measurement_type_name='YanChengCHEOK';
measurement_type_id
---------------------
1
(1 row)
Time: 331.057 ms
I try to have it in stored procedures.
DECLARE
_measurement_type_id int8;
BEGIN
SELECT measurement_type_id INTO _measurement_type_id FROM measurement_type
WHERE measurement_type_name='YanChengCHEOK';
RAISE NOTICE '%', _measurement_type_id;
return 1;
end;
It tools me only 1.018ms
High chance that PostgreSQL stop looking further, when it found that the
variable int8 had been fill in with at most 1 value.
Without using stored procedure, how can I send a SQL statement to PostgreSQL,
to tell it that I need only 1 measurement_type_id, to speed up the SELECT speed.
Thanks and Regards
Yan Cheng CHEOK
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general