\d "Cal" Table "public.Cal" Column | Type | Modifiers -------------------+-----------------------+----------- calSeqNo | "CalSeqNoT" | not null countyNo | "CountyNoT" | not null activityType | "ActivityTypeT" | not null calDate | "DateT" | not null calRecType | character(1) | not null ctofcNo | "CtofcNoT" | not null isCourtType | boolean | not null isNotcPrinted | boolean | not null isPrintOnDlyCal | boolean | not null lastSpclNotcSeqNo | "SpclNotcSeqNoT" | not null priority | "PriorityT" | not null startTime | "TimeT" | not null calDispoCode | "CalDispoCodeT" | calTxt | "TextT" | caseNo | "CaseNoT" | comments | character varying(90) | ctofcAddrSeqNo | smallint | dispoDate | "DateT" | endTime | "TimeT" | estDuration | "CalDurationT" | estPd | "PdCodeT" | loc | "LocT" | masterCalSeqNo | "CalSeqNoT" | rptrCode | "CtofcNoT" | tag | "TagTypeT" | gwMessageId | "GwMessageIdT" | Indexes: "Cal_pkey" PRIMARY KEY, btree ("countyNo", "calSeqNo") "Cal_CalDate" UNIQUE, btree ("calDate", "countyNo", "calDispoCode", "activityType", "caseNo", "calRecType", "calSeqNo") "Cal_CaseNo" UNIQUE, btree ("caseNo", "countyNo", "calSeqNo") "Cal_CtofcNo" UNIQUE, btree ("ctofcNo", "calDate", "countyNo", "startTime", priority, "calSeqNo") explain analyze SELECT "CA"."calDate", "CA"."startTime" FROM "Cal" "CA" WHERE "CA"."ctofcNo" = '2192' AND "CA"."calDate" between '2006-03-15' AND '2006-03-15' ORDER BY "calDate", "startTime"; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=4.03..4.03 rows=1 width=12) (actual time=9283.560..9283.568 rows=4 loops=1) Sort Key: "calDate", "startTime" -> Index Scan using "Cal_CalDate" on "Cal" "CA" (cost=0.00..4.02 rows=1 width=12) (actual time=532.246..9283.450 rows=4 loops=1) Index Cond: ((("calDate")::date >= '2006-03-15'::date) AND (("calDate")::date <= '2006-03-15'::date)) Filter: (("ctofcNo")::bpchar = '2192'::bpchar) Total runtime: 9283.758 ms (6 rows) explain analyze SELECT "CA"."calDate", "CA"."startTime" FROM "Cal" "CA" WHERE "CA"."ctofcNo" = '2192' AND "CA"."calDate" = '2006-03-15' ORDER BY "calDate", "startTime"; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- Sort (cost=24.36..24.39 rows=11 width=12) (actual time=0.715..0.723 rows=4 loops=1) Sort Key: "calDate", "startTime" -> Index Scan using "Cal_CtofcNo" on "Cal" "CA" (cost=0.00..24.17 rows=11 width=12) (actual time=0.424..0.628 rows=4 loops=1) Index Cond: ((("ctofcNo")::bpchar = '2192'::bpchar) AND (("calDate")::date = '2006-03-15'::date)) Total runtime: 0.828 ms (5 rows) explain analyze SELECT "CA"."calDate", "CA"."startTime" FROM "Cal" "CA" WHERE "CA"."ctofcNo" = '2192' AND "CA"."calDate" between '2006-03-15' AND '2006-03-16' ORDER BY "calDate", "startTime"; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=4.03..4.03 rows=1 width=12) (actual time=5.384..5.494 rows=59 loops=1) Sort Key: "calDate", "startTime" -> Index Scan using "Cal_CtofcNo" on "Cal" "CA" (cost=0.00..4.02 rows=1 width=12) (actual time=0.377..5.133 rows=59 loops=1) Index Cond: ((("ctofcNo")::bpchar = '2192'::bpchar) AND (("calDate")::date >= '2006-03-15'::date) AND (("calDate")::date <= '2006-03-16'::date)) Total runtime: 5.686 ms (5 rows)