diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 26089352..b16149a 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -786,7 +786,7 @@ exec_command(const char *cmd,
 				opt[--len] = '\0';
 		}
 
-		helpSQL(opt, pset.popt.topt.pager);
+		helpSQL(opt, pset.popt.topt.pager, pset.popt.topt.pager_min_lines);
 		free(opt);
 	}
 
@@ -1053,7 +1053,8 @@ exec_command(const char *cmd,
 			static const char *const my_list[] = {
 				"border", "columns", "expanded", "fieldsep", "fieldsep_zero",
 				"footer", "format", "linestyle", "null",
-				"numericlocale", "pager", "recordsep", "recordsep_zero",
+				"numericlocale", "pager", "pager_min_lines", 
+				"recordsep", "recordsep_zero",
 				"tableattr", "title", "tuples_only",
 				"unicode_border_linestyle",
 				"unicode_column_linestyle",
@@ -1252,7 +1253,8 @@ exec_command(const char *cmd,
 					lines++;
 				}
 
-				output = PageOutput(lineno, pset.popt.topt.pager);
+				output = PageOutput(lineno, pset.popt.topt.pager,
+					pset.popt.topt.pager_min_lines);
 				is_pager = true;
 			}
 			else
@@ -1504,13 +1506,13 @@ exec_command(const char *cmd,
 													OT_NORMAL, NULL, false);
 
 		if (!opt0 || strcmp(opt0, "commands") == 0)
-			slashUsage(pset.popt.topt.pager);
+			slashUsage(pset.popt.topt.pager, pset.popt.topt.pager_min_lines);
 		else if (strcmp(opt0, "options") == 0)
-			usage(pset.popt.topt.pager);
+			usage(pset.popt.topt.pager, pset.popt.topt.pager_min_lines);
 		else if (strcmp(opt0, "variables") == 0)
-			helpVariables(pset.popt.topt.pager);
+			helpVariables(pset.popt.topt.pager, pset.popt.topt.pager_min_lines);
 		else
-			slashUsage(pset.popt.topt.pager);
+			slashUsage(pset.popt.topt.pager, pset.popt.topt.pager_min_lines);
 	}
 
 #if 0
@@ -2506,6 +2508,13 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
 			popt->topt.pager = 1;
 	}
 
+	/* set minimum lines for pager use */
+	else if (strcmp(param, "pager_min_lines") == 0)
+	{
+		if (value)
+			popt->topt.pager_min_lines = atoi(value);		
+	}
+
 	/* disable "(x rows)" footer */
 	else if (strcmp(param, "footer") == 0)
 	{
@@ -2627,6 +2636,13 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
 			printf(_("Pager usage is off.\n"));
 	}
 
+	/* show minimum lines for pager use */
+	else if (strcmp(param, "pager_min_lines") == 0)
+	{
+		printf(_("Pager won't be used for less than %d lines\n"),
+			   popt->topt.pager_min_lines);
+	}
+
 	/* show record separator for unaligned text */
 	else if (strcmp(param, "recordsep") == 0)
 	{
@@ -2779,6 +2795,8 @@ pset_value_string(const char *param, struct printQueryOpt *popt)
 		return pstrdup(pset_bool_string(popt->topt.numericLocale));
 	else if (strcmp(param, "pager") == 0)
 		return psprintf("%d", popt->topt.pager);
+	else if (strcmp(param, "pager_min_lines") == 0)
+		return psprintf("%d", popt->topt.pager_min_lines);
 	else if (strcmp(param, "recordsep") == 0)
 		return pset_quoted_string(popt->topt.recordSep.separator
 								  ? popt->topt.recordSep.separator
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 66d80b5..91102f4 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1337,7 +1337,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
 			 * If query requires multiple result sets, hack to ensure that
 			 * only one pager instance is used for the whole mess
 			 */
-			pset.queryFout = PageOutput(100000, my_popt.topt.pager);
+			pset.queryFout = PageOutput(100000, my_popt.topt.pager,
+				my_popt.topt.pager_min_lines);
 			did_pager = true;
 		}
 
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index ae5fe88..bb166b9 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -46,7 +46,7 @@
 #define ON(var) (var ? _("on") : _("off"))
 
 void
-usage(unsigned short int pager)
+usage(unsigned short int pager, int pager_min_lines)
 {
 	const char *env;
 	const char *user;
@@ -65,7 +65,7 @@ usage(unsigned short int pager)
 		}
 	}
 
-	output = PageOutput(59, pager);
+	output = PageOutput(59, pager, pager_min_lines);
 
 	fprintf(output, _("psql is the PostgreSQL interactive terminal.\n\n"));
 	fprintf(output, _("Usage:\n"));
@@ -151,14 +151,14 @@ usage(unsigned short int pager)
  * print out help for the backslash commands
  */
 void
-slashUsage(unsigned short int pager)
+slashUsage(unsigned short int pager, int pager_min_lines)
 {
 	FILE	   *output;
 	char	   *currdb;
 
 	currdb = PQdb(pset.db);
 
-	output = PageOutput(103, pager);
+	output = PageOutput(103, pager, pager_min_lines);
 
 	/* if you add/remove a line here, change the row count above */
 
@@ -301,11 +301,11 @@ slashUsage(unsigned short int pager)
  * show list of available variables (options) from command line
  */
 void
-helpVariables(unsigned short int pager)
+helpVariables(unsigned short int pager,	int pager_min_lines)
 {
 	FILE	   *output;
 
-	output = PageOutput(85, pager);
+	output = PageOutput(85, pager, pager_min_lines);
 
 	fprintf(output, _("List of specially treated variables.\n"));
 
@@ -406,7 +406,7 @@ helpVariables(unsigned short int pager)
  * Note: we assume caller removed any trailing spaces in "topic".
  */
 void
-helpSQL(const char *topic, unsigned short int pager)
+helpSQL(const char *topic, unsigned short int pager, int pager_min_lines)
 {
 #define VALUE_OR_NULL(a) ((a) ? (a) : "")
 
@@ -435,7 +435,7 @@ helpSQL(const char *topic, unsigned short int pager)
 		ncolumns = Max(ncolumns, 1);
 		nrows = (QL_HELP_COUNT + (ncolumns - 1)) / ncolumns;
 
-		output = PageOutput(nrows + 1, pager);
+		output = PageOutput(nrows + 1, pager, pager_min_lines);
 
 		fputs(_("Available help:\n"), output);
 
@@ -488,7 +488,7 @@ helpSQL(const char *topic, unsigned short int pager)
 				if (wordlen >= len)		/* Don't try again if the same word */
 				{
 					if (!output)
-						output = PageOutput(nl_count, pager);
+						output = PageOutput(nl_count, pager, pager_min_lines);
 					break;
 				}
 				len = wordlen;
@@ -509,7 +509,7 @@ helpSQL(const char *topic, unsigned short int pager)
 			}
 
 			if (!output)
-				output = PageOutput(nl_count, pager);
+				output = PageOutput(nl_count, pager, pager_min_lines);
 
 			for (i = 0; QL_HELP[i].cmd; i++)
 			{
diff --git a/src/bin/psql/help.h b/src/bin/psql/help.h
index 3ad374a..646d080 100644
--- a/src/bin/psql/help.h
+++ b/src/bin/psql/help.h
@@ -8,13 +8,14 @@
 #ifndef HELP_H
 #define HELP_H
 
-void		usage(unsigned short int pager);
+void		usage(unsigned short int pager, int pager_min_lines);
 
-void		slashUsage(unsigned short int pager);
+void		slashUsage(unsigned short int pager, int pager_min_lines);
 
-void		helpVariables(unsigned short int pager);
+void		helpVariables(unsigned short int pager, int pager_min_lines);
 
-void		helpSQL(const char *topic, unsigned short int pager);
+void		helpSQL(const char *topic, unsigned short int pager,
+					int pager_min_lines);
 
 void		print_copyright(void);
 
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 6416ab9..01111e8 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -479,7 +479,7 @@ printHistory(const char *fname, unsigned short int pager)
 	if (fname == NULL)
 	{
 		/* use pager, if enabled, when printing to console */
-		output = PageOutput(INT_MAX, pager);
+		output = PageOutput(INT_MAX, pager, 0);
 		is_pager = true;
 	}
 	else
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 3b3c3b7..2e158b8 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -811,7 +811,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
 	if (!is_pager && fout == stdout && output_columns > 0 &&
 		(output_columns < total_header_width || output_columns < width_total))
 	{
-		fout = PageOutput(INT_MAX, cont->opt->pager);	/* force pager */
+		fout = PageOutput(INT_MAX, cont->opt->pager,
+						  cont->opt->pager_min_lines);	/* force pager */
 		is_pager = true;
 	}
 
@@ -2487,7 +2488,7 @@ print_troff_ms_vertical(const printTableContent *cont, FILE *fout)
  * Tests if pager is needed and returns appropriate FILE pointer.
  */
 FILE *
-PageOutput(int lines, unsigned short int pager)
+PageOutput(int lines, unsigned short int pager, int min_lines)
 {
 	/* check whether we need / can / are supposed to use pager */
 	if (pager && isatty(fileno(stdin)) && isatty(fileno(stdout)))
@@ -2502,7 +2503,9 @@ PageOutput(int lines, unsigned short int pager)
 		result = ioctl(fileno(stdout), TIOCGWINSZ, &screen_size);
 
 		/* >= accounts for a one-line prompt */
-		if (result == -1 || lines >= screen_size.ws_row || pager > 1)
+		if (result == -1 
+			|| (lines >= screen_size.ws_row && lines >= min_lines)
+			|| pager > 1)
 		{
 #endif
 			pagerprog = getenv("PAGER");
@@ -2802,7 +2805,8 @@ IsPagerNeeded(const printTableContent *cont, const int extra_lines, bool expande
 				lines++;
 		}
 
-		*fout = PageOutput(lines + extra_lines, cont->opt->pager);
+		*fout = PageOutput(lines + extra_lines, cont->opt->pager,
+						   cont->opt->pager_min_lines);
 		*is_pager = (*fout != stdout);
 	}
 	else
diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h
index f668b23..3510f7a 100644
--- a/src/bin/psql/print.h
+++ b/src/bin/psql/print.h
@@ -89,6 +89,8 @@ typedef struct printTableOpt
 								 * 1=dividing lines, 2=full */
 	unsigned short int pager;	/* use pager for output (if to stdout and
 								 * stdout is a tty) 0=off 1=on 2=always */
+	int         pager_min_lines;/* don't use pager unless there are at least
+								 * this many lines */
 	bool		tuples_only;	/* don't output headers, row counts, etc. */
 	bool		start_table;	/* print start decoration, eg <table> */
 	bool		stop_table;		/* print stop decoration, eg </table> */
@@ -164,7 +166,7 @@ extern const printTextFormat pg_asciiformat_old;
 extern const printTextFormat pg_utf8format;
 
 
-extern FILE *PageOutput(int lines, unsigned short int pager);
+extern FILE *PageOutput(int lines, unsigned short int pager, int min_lines);
 extern void ClosePager(FILE *pagerpipe);
 
 extern void html_escaped_print(const char *in, FILE *fout);
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 11a159a..174c481 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -100,7 +100,7 @@ main(int argc, char *argv[])
 	{
 		if ((strcmp(argv[1], "-?") == 0) || (argc == 2 && (strcmp(argv[1], "--help") == 0)))
 		{
-			usage(NOPAGER);
+			usage(NOPAGER, 0);
 			exit(EXIT_SUCCESS);
 		}
 		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
@@ -129,6 +129,7 @@ main(int argc, char *argv[])
 	pset.popt.topt.format = PRINT_ALIGNED;
 	pset.popt.topt.border = 1;
 	pset.popt.topt.pager = 1;
+	pset.popt.topt.pager_min_lines = 0;
 	pset.popt.topt.start_table = true;
 	pset.popt.topt.stop_table = true;
 	pset.popt.topt.default_footer = true;
@@ -569,7 +570,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
 				/* Actual help option given */
 				if (strcmp(argv[optind - 1], "-?") == 0)
 				{
-					usage(NOPAGER);
+					usage(NOPAGER, 0);
 					exit(EXIT_SUCCESS);
 				}
 				/* unknown option reported by getopt */
@@ -579,11 +580,11 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
 			case 1:
 				{
 					if (!optarg || strcmp(optarg, "options") == 0)
-						usage(NOPAGER);
+						usage(NOPAGER, 0);
 					else if (optarg && strcmp(optarg, "commands") == 0)
-						slashUsage(NOPAGER);
+						slashUsage(NOPAGER, 0);
 					else if (optarg && strcmp(optarg, "variables") == 0)
-						helpVariables(NOPAGER);
+						helpVariables(NOPAGER, 0);
 					else
 						goto unknown_option;
 
